Documentation ¶
Index ¶
- Constants
- type Bucket
- func (*Bucket) Descriptor() ([]byte, []int)
- func (m *Bucket) GetItems() []*Item
- func (m *Bucket) GetKey() string
- func (*Bucket) ProtoMessage()
- func (m *Bucket) Reset()
- func (m *Bucket) String() string
- func (m *Bucket) XXX_DiscardUnknown()
- func (m *Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Bucket) XXX_Merge(src proto.Message)
- func (m *Bucket) XXX_Size() int
- func (m *Bucket) XXX_Unmarshal(b []byte) error
- type Item
- func (*Item) Descriptor() ([]byte, []int)
- func (m *Item) GetID() string
- func (m *Item) GetMessage() *any.Any
- func (*Item) ProtoMessage()
- func (m *Item) Reset()
- func (m *Item) String() string
- func (m *Item) XXX_DiscardUnknown()
- func (m *Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Item) XXX_Merge(src proto.Message)
- func (m *Item) XXX_Size() int
- func (m *Item) XXX_Unmarshal(b []byte) error
- type StoragePacker
- func (s *StoragePacker) BucketKey(itemID string) string
- func (s *StoragePacker) BucketKeyHashByItemID(itemID string) string
- func (s *StoragePacker) BucketKeyHashByKey(bucketKey string) string
- func (s *StoragePacker) BucketPath(bucketKey string) string
- func (s *StoragePacker) DeleteItem(itemID string) error
- func (s *StoragePacker) DeleteMultipleItems(ctx context.Context, logger hclog.Logger, itemIDs ...string) error
- func (s *StoragePacker) GetBucket(key string) (*Bucket, error)
- func (s *StoragePacker) GetItem(itemID string) (*Item, error)
- func (s *StoragePacker) PutItem(item *Item) error
- func (s *StoragePacker) View() logical.Storage
Constants ¶
const ( // StoragePackerBucketsPrefix is the default storage key prefix under which // bucket data will be stored. StoragePackerBucketsPrefix = "packer/buckets/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct { Key string `sentinel:"" protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Items []*Item `sentinel:"" protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Bucket) Descriptor ¶
func (*Bucket) ProtoMessage ¶
func (*Bucket) ProtoMessage()
func (*Bucket) XXX_DiscardUnknown ¶
func (m *Bucket) XXX_DiscardUnknown()
func (*Bucket) XXX_Marshal ¶
func (*Bucket) XXX_Unmarshal ¶
type Item ¶
type Item struct { ID string `sentinel:"" protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Message *any.Any `sentinel:"" protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Item) Descriptor ¶
func (*Item) GetMessage ¶
func (*Item) ProtoMessage ¶
func (*Item) ProtoMessage()
func (*Item) XXX_DiscardUnknown ¶
func (m *Item) XXX_DiscardUnknown()
func (*Item) XXX_Unmarshal ¶
type StoragePacker ¶
type StoragePacker struct {
// contains filtered or unexported fields
}
StoragePacker packs items into a specific number of buckets by hashing its identifier and indexing on it. Currently this supports only 256 bucket entries and hence relies on the first byte of the hash value for indexing.
func NewStoragePacker ¶
func NewStoragePacker(view logical.Storage, logger log.Logger, viewPrefix string) (*StoragePacker, error)
NewStoragePacker creates a new storage packer for a given view
func (*StoragePacker) BucketKey ¶
func (s *StoragePacker) BucketKey(itemID string) string
BucketKey returns the storage key of the bucket where the given item will be stored.
func (*StoragePacker) BucketKeyHashByItemID ¶
func (s *StoragePacker) BucketKeyHashByItemID(itemID string) string
BucketKeyHash returns the MD5 hash of the bucket storage key in which the item will be stored. The choice of MD5 is only for hash performance reasons since its value is not used for any security sensitive operation.
func (*StoragePacker) BucketKeyHashByKey ¶
func (s *StoragePacker) BucketKeyHashByKey(bucketKey string) string
BucketKeyHashByKey returns the MD5 hash of the bucket storage key
func (*StoragePacker) BucketPath ¶
func (s *StoragePacker) BucketPath(bucketKey string) string
BucketPath returns the storage entry key for a given bucket key
func (*StoragePacker) DeleteItem ¶
func (s *StoragePacker) DeleteItem(itemID string) error
DeleteItem removes the item from the respective bucket
func (*StoragePacker) DeleteMultipleItems ¶
func (*StoragePacker) GetBucket ¶
func (s *StoragePacker) GetBucket(key string) (*Bucket, error)
GetBucket returns a bucket for a given key
func (*StoragePacker) GetItem ¶
func (s *StoragePacker) GetItem(itemID string) (*Item, error)
GetItem fetches the storage entry for a given key from its corresponding bucket.
func (*StoragePacker) PutItem ¶
func (s *StoragePacker) PutItem(item *Item) error
PutItem stores the given item in its respective bucket
func (*StoragePacker) View ¶
func (s *StoragePacker) View() logical.Storage
View returns the storage view configured to be used by the packer