BucketManager

Struct BucketManager 

Source
pub struct BucketManager { /* private fields */ }
Expand description

Manages creation and lifecycle of object store buckets.

Buckets are logical containers within a pool. The bucket manager tracks which buckets exist and their metadata.

§Example

use grafos_store::BucketManager;

let mut mgr = BucketManager::new("default");
mgr.create("images").unwrap();
mgr.create("logs").unwrap();

assert!(mgr.exists("images"));
assert_eq!(mgr.list().len(), 2);

Implementations§

Source§

impl BucketManager

Source

pub fn new(pool: &str) -> Self

Create a new bucket manager for the given pool.

Source

pub fn create(&mut self, name: &str) -> Result<&BucketInfo>

Create a new bucket. Returns an error if the bucket already exists.

Source

pub fn exists(&self, name: &str) -> bool

Check if a bucket exists.

Source

pub fn get(&self, name: &str) -> Option<&BucketInfo>

Get bucket info by name.

Source

pub fn drop_bucket(&mut self, name: &str) -> bool

Drop (delete) a bucket by name. Returns true if it existed.

Source

pub fn list(&self) -> Vec<&str>

List all bucket names.

Source

pub fn pool(&self) -> &str

The pool this manager belongs to.

Source

pub fn create_bucket(&mut self, config: BucketConfig) -> Result<BucketHandle>

Create a bucket from a configuration, returning a typed handle.

Source

pub fn open_bucket(&self, name: &str) -> Result<BucketHandle>

Open an existing bucket by name, returning a typed handle.

Source

pub fn publish(&mut self, handle: &BucketHandle) -> BucketLocator

Publish a bucket handle as a locator for cross-app discovery.

Source

pub fn discover(&self, name: &str) -> Option<&BucketLocator>

Discover a previously published bucket locator by name.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.