Hermes  0.9.5-beta
Hierarchical Distributed I/O Buffering System
hermes::api::VBucket Class Reference

#include <vbucket.h>

Collaboration diagram for hermes::api::VBucket:

Public Member Functions

 VBucket (std::string initial_name, std::shared_ptr< Hermes > const &hermes, Context ctx=Context())
 Create or open a VBucket. More...
 
 ~VBucket ()
 Close a VBucket. More...
 
bool IsValid () const
 Return bool{this VBucket is valid}. More...
 
std::string GetName () const
 Return the name of this VBucket. More...
 
void WaitForBackgroundFlush ()
 
Status Link (std::string blob_name, std::string bucket_name)
 
Status Link (std::string blob_name, std::string bucket_name, Context &ctx)
 
Status Unlink (std::string blob_name, std::string bucket_name, Context &ctx)
 
Status Unlink (std::string blob_name, std::string bucket_name)
 
bool ContainsBlob (std::string blob_name, std::string bucket_name)
 
size_t Get (const std::string &name, Bucket &bkt, Blob &user_blob, const Context &ctx)
 
size_t Get (const std::string &name, Bucket &bkt, Blob &user_blob)
 
size_t Get (const std::string &name, Bucket &bkt, void *user_blob, size_t blob_size, const Context &ctx)
 
size_t Get (const std::string &name, Bucket *bkt, Blob &user_blob, const Context &ctx)
 
size_t Get (const std::string &name, Bucket *bkt, Blob &user_blob)
 
size_t Get (const std::string &name, Bucket *bkt, void *user_blob, size_t blob_size, const Context &ctx)
 Retrieve a Blob into a user buffer.
 
std::vector< std::string > GetLinks (Context &ctx)
 
Status Attach (Trait *trait)
 Attach a Trait to this VBucket. More...
 
Status Attach (Trait *trait, Context &ctx)
 
Status Detach (Trait *trait)
 Detach a trait from this VBucket. More...
 
Status Detach (Trait *trait, Context &ctx)
 
template<class Predicate >
std::vector< TraitIDGetTraits (Predicate pred, Context &ctx)
 Retrieves the subset of attached traits satisfying the Predicate pred. More...
 
TraitGetTrait (TraitType type)
 Get's an attached Trait that matches type. More...
 
Status Release ()
 Release this vBucket. More...
 
Status Release (Context &ctx)
 
Status Destroy ()
 Destroy this VBucket. More...
 
Status Destroy (Context &ctx)
 

Private Attributes

std::string name_
 
VBucketID id_
 
std::list< Trait * > attached_traits_
 
std::shared_ptr< Hermeshermes_
 
Context ctx_
 

Detailed Description

Virtual buckets (VBuckets) capture relationships between Blobs across Bucket boundaries.

Constructor & Destructor Documentation

◆ VBucket()

hermes::api::VBucket::VBucket ( std::string  initial_name,
std::shared_ptr< Hermes > const &  hermes,
Context  ctx = Context() 
)

Create or open a VBucket.

If the VBucket initial_name doesn't already exist, it is created and registered in Hermes. If it does exists, it is opened and its reference count is incremented. Once a VBucket is created, it can be opened on any rank or node.

Parameters
initial_nameThe desired name of the VBucket.
hermesAn initialized Hermes instance.
ctxThe Context for this VBucket.
Precondition
The Hermes instance hermes must be be initialized.

◆ ~VBucket()

hermes::api::VBucket::~VBucket ( )

Close a VBucket.

This does not delete the VBucket from Hermes, it merely decrements the reference count. To delete the VBucket and all associated metadata use VBucket::Destroy.

Here is the call graph for this function:

Member Function Documentation

◆ IsValid()

bool hermes::api::VBucket::IsValid ( ) const

Return bool{this VBucket is valid}.

A VBucket is valid if it has a non-NULL ID, meaning it has been registered in the Hermes system.

Returns
true if this VBucket is valid, otherwise false.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetName()

std::string hermes::api::VBucket::GetName ( ) const

Return the name of this VBucket.

Returns
The name of this VBucket.

◆ WaitForBackgroundFlush()

void hermes::api::VBucket::WaitForBackgroundFlush ( )

Blocks until all outstanding asynchronous flushing tasks associated with this VBucket are complete.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Link() [1/2]

Status hermes::api::VBucket::Link ( std::string  blob_name,
std::string  bucket_name 
)

Link a Blob to this VBucket.

Adds Blob blob_name in Bucket bucket_name to this VBucket's list of Blobs. Additional calls the Trait::OnLinkFn function on the Blob for each attached Trait.

Parameters
blob_nameThe name of the Blob to link.
bucket_nameThe name of the Bucket containing the Blob to link.
Returns
A Status object.
Here is the caller graph for this function:

◆ Link() [2/2]

Status hermes::api::VBucket::Link ( std::string  blob_name,
std::string  bucket_name,
Context ctx 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
blob_nameThe name of the Blob to link.
bucket_nameThe name of the Bucket containing the Blob to link.
ctxCurrently unused.
Here is the call graph for this function:

◆ Unlink() [1/2]

Status hermes::api::VBucket::Unlink ( std::string  blob_name,
std::string  bucket_name,
Context ctx 
)

Unlink a Blob from this VBucket.

Parameters
blob_nameThe name of the Blob to unlink.
bucket_nameThe name of the Bucket containing the Blob to unlink.
ctxcontext
Returns
A Status object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Unlink() [2/2]

Status hermes::api::VBucket::Unlink ( std::string  blob_name,
std::string  bucket_name 
)
Todo:
Unlink
Here is the call graph for this function:

◆ ContainsBlob()

bool hermes::api::VBucket::ContainsBlob ( std::string  blob_name,
std::string  bucket_name 
)

check if blob is in this vbucket

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get() [1/5]

size_t hermes::api::VBucket::Get ( const std::string &  name,
Bucket bkt,
Blob user_blob,
const Context ctx 
)

Get a Blob, calling any OnGet callbacks of attached Traits.

Exactly like Bucket::Get, except this function invokes the OnGet callback of any attached Traits.

Here is the caller graph for this function:

◆ Get() [2/5]

size_t hermes::api::VBucket::Get ( const std::string &  name,
Bucket bkt,
Blob user_blob 
)

Get a Blob without context.

Here is the call graph for this function:

◆ Get() [3/5]

size_t hermes::api::VBucket::Get ( const std::string &  name,
Bucket bkt,
void *  user_blob,
size_t  blob_size,
const Context ctx 
)

Get a Blob with size and context.

Here is the call graph for this function:

◆ Get() [4/5]

size_t hermes::api::VBucket::Get ( const std::string &  name,
Bucket bkt,
Blob user_blob,
const Context ctx 
)

get a blob on this bucket

  • if user_blob.size() == 0 => return the minimum buffer size needed
  • if user_blob.size() > 0 => copy user_blob.size() bytes to user_blob and return user_blob.size() use provides buffer

◆ Get() [5/5]

size_t hermes::api::VBucket::Get ( const std::string &  name,
Bucket bkt,
Blob user_blob 
)

Get a blob on this bucket without context.

◆ GetLinks()

std::vector< std::string > hermes::api::VBucket::GetLinks ( Context ctx)

retrieves the subset of blob links satisfying pred could return iterator

Here is the call graph for this function:

◆ Attach() [1/2]

Status hermes::api::VBucket::Attach ( Trait trait)

Attach a Trait to this VBucket.

Calls the Trait::onAttachFn function of trait on each Blob that's linked to this VBucket.

Parameters
traitThe Trait to attach.
Returns
A Status object.
Here is the caller graph for this function:

◆ Attach() [2/2]

Status hermes::api::VBucket::Attach ( Trait trait,
Context ctx 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
traitThe Trait to attach.
ctxCurrently unused.
Here is the call graph for this function:

◆ Detach() [1/2]

Status hermes::api::VBucket::Detach ( Trait trait)

Detach a trait from this VBucket.

Parameters
traitThe Trait to detach.
Returns
A Status object.

◆ Detach() [2/2]

Status hermes::api::VBucket::Detach ( Trait trait,
Context ctx 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
traitThe Trait to detach.
ctxCurrently unused.
Here is the call graph for this function:

◆ GetTraits()

template<class Predicate >
std::vector< TraitID > hermes::api::VBucket::GetTraits ( Predicate  pred,
Context ctx 
)

Retrieves the subset of attached traits satisfying the Predicate pred.

Todo:
pred is curently ignored and this function returns all attached traits.
Parameters
pred
Todo:
Parameters
ctxCurrently unused;

◆ GetTrait()

Trait * hermes::api::VBucket::GetTrait ( TraitType  type)

Get's an attached Trait that matches type.

Parameters
typeThe type of Trait to retrieve.
Returns
The first attached trait that matches type.

◆ Release() [1/2]

Status hermes::api::VBucket::Release ( )

Release this vBucket.

This function does not result in any Trait callbacks being invoked or any Blob links to be deleted. It simply decrements the reference count on this VBucket. A VBucket can only be destroyed (VBucket::Destroy) when it's reference count is 1. I.e., each rank that is not destroying the VBucket must release it.

Returns
A Status.
Here is the caller graph for this function:

◆ Release() [2/2]

Status hermes::api::VBucket::Release ( Context ctx)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
ctxCurrently unused.
Here is the call graph for this function:

◆ Destroy() [1/2]

Status hermes::api::VBucket::Destroy ( )

Destroy this VBucket.

Releases all resources associated with this VBucket. If it is opened again, it will be created from scratch. Unlinks all linked Blobs (which will invoke each attached Trait's Trait::onUnlinkFn function), and detaches all attached Traits, invoking Trait::onDetachFn.

Returns
A Status object.
Here is the caller graph for this function:

◆ Destroy() [2/2]

Status hermes::api::VBucket::Destroy ( Context ctx)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
ctxCurrently unused.
Here is the call graph for this function:

Member Data Documentation

◆ name_

std::string hermes::api::VBucket::name_
private

The user-facing name of this VBucket.

◆ id_

VBucketID hermes::api::VBucket::id_
private

The internal ID of this VBucket.

◆ attached_traits_

std::list<Trait *> hermes::api::VBucket::attached_traits_
private

Traits attached to this vbucket.

◆ hermes_

std::shared_ptr<Hermes> hermes::api::VBucket::hermes_
private

The Hermes instance this VBucket is stored in.

◆ ctx_

Context hermes::api::VBucket::ctx_
private

The Context for this VBucket. Overrides the global default Context.


The documentation for this class was generated from the following files: