13 #ifndef HERMES_TRAITS_H
14 #define HERMES_TRAITS_H
16 #include <unordered_map>
24 #define HERMES_PERSIST_TRAIT 11
25 #define HERMES_WRITE_ONLY_TRAIT 12
37 using HermesPtr = std::shared_ptr<Hermes>;
43 typedef std::function<void(HermesPtr,
TraitInput &,
Trait *)> OnLinkCallback;
45 typedef std::function<void(HermesPtr,
VBucketID,
Trait *)> OnAttachCallback;
98 using OffsetMap = std::unordered_map<std::string, u64>;
TraitType
Trait types.
Definition: hermes_types.h:428
Definition: adapter_utils.cc:35
u64 TraitID
Definition: hermes_types.h:421
std::string bucket_name
Definition: traits.h:30
std::string blob_name
Definition: traits.h:32
Engable persisting a VBucket's linked Blobs to permanent storage.
Definition: traits.h:89
std::string filename
Definition: traits.h:91
void onUnlink(HermesPtr hermes, TraitInput &input, Trait *trait)
Currently a no-op.
Definition: traits.cc:92
bool synchronous
Definition: traits.h:95
PersistTrait(bool synchronous)
void onAttach(HermesPtr hermes, VBucketID id, Trait *trait)
Definition: traits.cc:51
std::unordered_map< std::string, u64 > offset_map
Definition: traits.h:93
std::unordered_map< std::string, u64 > OffsetMap
Definition: traits.h:98
void onDetach(HermesPtr hermes, VBucketID id, Trait *trait)
Currently a no-op.
Definition: traits.cc:66
void onLink(HermesPtr hermes, TraitInput &input, Trait *trait)
Definition: traits.cc:72
Base class for Traits, which can attach functionality to VBuckets.
Definition: traits.h:52
OnLinkCallback onUnlinkFn
Definition: traits.h:66
OnAttachCallback onDetachFn
Definition: traits.h:62
OnLinkCallback onGetFn
Definition: traits.h:68
OnAttachCallback onAttachFn
Definition: traits.h:60
TraitType type
Definition: traits.h:58
TraitID id
Definition: traits.h:54
OnLinkCallback onLinkFn
Definition: traits.h:64
Trait()
Default constructor.
Definition: traits.h:73
std::vector< TraitID > conflict_traits
Definition: traits.h:56
Marks the Blobs in a VBucket as write-only.
Definition: traits.h:130
void onAttach(HermesPtr hermes, VBucketID id, Trait *trait)
Currently a no-op.
Definition: traits.cc:114
void onDetach(HermesPtr hermes, VBucketID id, Trait *trait)
Currently a no-op.
Definition: traits.cc:120
void onUnlink(HermesPtr hermes, TraitInput &input, Trait *trait)
Currently a no-op.
Definition: traits.cc:138
void onLink(HermesPtr hermes, TraitInput &input, Trait *trait)
Definition: traits.cc:126
Definition: hermes_types.h:388