Hermes
0.9.5-beta
Hierarchical Distributed I/O Buffering System
|
#include <vbucket.h>
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< TraitID > | GetTraits (Predicate pred, Context &ctx) |
Retrieves the subset of attached traits satisfying the Predicate pred . More... | |
Trait * | GetTrait (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< Hermes > | hermes_ |
Context | ctx_ |
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.
initial_name | The desired name of the VBucket. |
hermes | An initialized Hermes instance. |
ctx | The Context for this VBucket. |
hermes
must be be initialized. 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.
bool hermes::api::VBucket::IsValid | ( | ) | const |
std::string hermes::api::VBucket::GetName | ( | ) | const |
void hermes::api::VBucket::WaitForBackgroundFlush | ( | ) |
Blocks until all outstanding asynchronous flushing tasks associated with this VBucket are complete.
Status hermes::api::VBucket::Link | ( | std::string | blob_name, |
std::string | bucket_name | ||
) |
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.
blob_name | The name of the Blob to link. |
bucket_name | The name of the Bucket containing the Blob to link. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
blob_name | The name of the Blob to link. |
bucket_name | The name of the Bucket containing the Blob to link. |
ctx | Currently unused. |
Status hermes::api::VBucket::Unlink | ( | std::string | blob_name, |
std::string | bucket_name | ||
) |
bool hermes::api::VBucket::ContainsBlob | ( | std::string | blob_name, |
std::string | bucket_name | ||
) |
check if blob is in this vbucket
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.
size_t hermes::api::VBucket::Get | ( | const std::string & | name, |
Bucket * | bkt, | ||
Blob & | user_blob, | ||
const Context & | ctx | ||
) |
get a blob on this bucket
Get a blob on this bucket without context.
std::vector< std::string > hermes::api::VBucket::GetLinks | ( | Context & | ctx | ) |
retrieves the subset of blob links satisfying pred could return iterator
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
trait | The Trait to attach. |
ctx | Currently unused. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
trait | The Trait to detach. |
ctx | Currently unused. |
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.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
ctx | Currently unused. |
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.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
ctx | Currently unused. |
|
private |
The user-facing name of this VBucket.
|
private |
Traits attached to this vbucket.
|
private |
|
private |