Documentation ¶
Index ¶
- Constants
- Variables
- type BoltDBCollectionWrapper
- func (c *BoltDBCollectionWrapper) Delete(key []byte) error
- func (c *BoltDBCollectionWrapper) Fetch(id uint64) ([]byte, error)
- func (c *BoltDBCollectionWrapper) FetchAll() ([][]byte, error)
- func (c *BoltDBCollectionWrapper) FetchBy(key []byte) ([]byte, error)
- func (c *BoltDBCollectionWrapper) Logger() logging.LoggerInterface
- func (c *BoltDBCollectionWrapper) Save(item CollectionItem) (uint64, error)
- func (c *BoltDBCollectionWrapper) SaveAs(key []byte, item interface{}) error
- func (c *BoltDBCollectionWrapper) Update(item CollectionItem) error
- type BoltDBWrapper
- type CollectionItem
- type CollectionWrapper
- type DBWrapper
- type SegmentChangesCollection
- type SegmentChangesCollectionImpl
- func (c *SegmentChangesCollectionImpl) ChangeNumber(segment string) int64
- func (c *SegmentChangesCollectionImpl) Fetch(name string) (*SegmentChangesItem, error)
- func (c *SegmentChangesCollectionImpl) FetchAll() ([]SegmentChangesItem, error)
- func (c *SegmentChangesCollectionImpl) SetChangeNumber(segment string, cn int64)
- func (c *SegmentChangesCollectionImpl) Update(name string, toAdd *set.ThreadUnsafeSet, toRemove *set.ThreadUnsafeSet, ...) error
- type SegmentChangesItem
- type SegmentKey
- type SplitChangesCollection
- type SplitChangesItem
- type SplitsChangesItems
Constants ¶
const BoltInMemoryMode = ":memory:"
BoltInMemoryMode used to store ramdom db into temporal folder
Variables ¶
var ErrorBucketNotFound = errors.New("Bucket not found")
ErrorBucketNotFound error type for bucket not found
var ErrorKeyNotFound = errors.New("key not found")
ErrorKeyNotFound error type for key not found within a bucket
Functions ¶
This section is empty.
Types ¶
type BoltDBCollectionWrapper ¶
type BoltDBCollectionWrapper struct {
// contains filtered or unexported fields
}
BoltDBCollectionWrapper wraps a boltdb collection (aka bucket)
func (*BoltDBCollectionWrapper) Delete ¶
func (c *BoltDBCollectionWrapper) Delete(key []byte) error
Delete removess an item into collection under key parameter
func (*BoltDBCollectionWrapper) Fetch ¶
func (c *BoltDBCollectionWrapper) Fetch(id uint64) ([]byte, error)
Fetch returns an item from collection
func (*BoltDBCollectionWrapper) FetchAll ¶
func (c *BoltDBCollectionWrapper) FetchAll() ([][]byte, error)
FetchAll fetch all saved items
func (*BoltDBCollectionWrapper) FetchBy ¶
func (c *BoltDBCollectionWrapper) FetchBy(key []byte) ([]byte, error)
FetchBy returns an item from collection given a key
func (*BoltDBCollectionWrapper) Logger ¶
func (c *BoltDBCollectionWrapper) Logger() logging.LoggerInterface
Logger returns a reference to a logger
func (*BoltDBCollectionWrapper) Save ¶
func (c *BoltDBCollectionWrapper) Save(item CollectionItem) (uint64, error)
Save an item into collection setting autoincrement ID
func (*BoltDBCollectionWrapper) SaveAs ¶
func (c *BoltDBCollectionWrapper) SaveAs(key []byte, item interface{}) error
SaveAs saves an item into collection under key parameter
func (*BoltDBCollectionWrapper) Update ¶
func (c *BoltDBCollectionWrapper) Update(item CollectionItem) error
Update an item into collection with current item ID
type BoltDBWrapper ¶
type BoltDBWrapper struct {
// contains filtered or unexported fields
}
BoltDBWrapper is a boltdb-based implmentation of a persistent storage wrapper
func NewBoltWrapper ¶
func NewBoltWrapper(path string, options *bolt.Options) (*BoltDBWrapper, error)
NewBoltWrapper creates a new instance of BoltDB wrapper
func (*BoltDBWrapper) GetRawSnapshot ¶
func (b *BoltDBWrapper) GetRawSnapshot() ([]byte, error)
GetRawSnapshot dumps all the contents of the db into a raw byte buffer
func (*BoltDBWrapper) Lock ¶
func (b *BoltDBWrapper) Lock()
Lock grants exclusive access to the referenced db
func (*BoltDBWrapper) Unlock ¶
func (b *BoltDBWrapper) Unlock()
Unlock reliquishes exclusive access to the referenced db
type CollectionItem ¶
CollectionItem is the item into a collection
type CollectionWrapper ¶
type CollectionWrapper interface { Delete(key []byte) error SaveAs(key []byte, item interface{}) error Save(item CollectionItem) (uint64, error) Update(item CollectionItem) error Fetch(id uint64) ([]byte, error) FetchBy(key []byte) ([]byte, error) FetchAll() ([][]byte, error) Logger() logging.LoggerInterface }
CollectionWrapper defines the set of methods that should be implemented by a collection
type DBWrapper ¶
type DBWrapper interface { Update(func(*bolt.Tx) error) error View(func(*bolt.Tx) error) error Lock() Unlock() GetRawSnapshot() ([]byte, error) }
DBWrapper defines the interface for a Persistant storage wrapper
type SegmentChangesCollection ¶
type SegmentChangesCollection interface { Update(name string, toAdd *set.ThreadUnsafeSet, toRemove *set.ThreadUnsafeSet, cn int64) error Fetch(name string) (*SegmentChangesItem, error) ChangeNumber(segment string) int64 SetChangeNumber(segment string, cn int64) }
type SegmentChangesCollectionImpl ¶ added in v5.4.2
type SegmentChangesCollectionImpl struct {
// contains filtered or unexported fields
}
SegmentChangesCollectionImpl represents a collection of SplitChangesItem
func NewSegmentChangesCollection ¶
func NewSegmentChangesCollection(db DBWrapper, logger logging.LoggerInterface) *SegmentChangesCollectionImpl
NewSegmentChangesCollection returns an instance of SegmentChangesCollection
func (*SegmentChangesCollectionImpl) ChangeNumber ¶ added in v5.4.2
func (c *SegmentChangesCollectionImpl) ChangeNumber(segment string) int64
ChangeNumber returns changeNumber
func (*SegmentChangesCollectionImpl) Fetch ¶ added in v5.4.2
func (c *SegmentChangesCollectionImpl) Fetch(name string) (*SegmentChangesItem, error)
Fetch return a SegmentChangesItem
func (*SegmentChangesCollectionImpl) FetchAll ¶ added in v5.4.2
func (c *SegmentChangesCollectionImpl) FetchAll() ([]SegmentChangesItem, error)
FetchAll return a list of SegmentChangesItem
func (*SegmentChangesCollectionImpl) SetChangeNumber ¶ added in v5.4.2
func (c *SegmentChangesCollectionImpl) SetChangeNumber(segment string, cn int64)
SetChangeNumber returns changeNumber
func (*SegmentChangesCollectionImpl) Update ¶ added in v5.4.2
func (c *SegmentChangesCollectionImpl) Update(name string, toAdd *set.ThreadUnsafeSet, toRemove *set.ThreadUnsafeSet, cn int64) error
Update persists a segmentChanges update
type SegmentChangesItem ¶
type SegmentChangesItem struct { Name string Keys map[string]SegmentKey }
SegmentChangesItem represents an SplitChanges service response
type SegmentKey ¶
SegmentKey represents a segment key data
type SplitChangesCollection ¶
type SplitChangesCollection struct {
// contains filtered or unexported fields
}
SplitChangesCollection represents a collection of SplitChangesItem
func NewSplitChangesCollection ¶
func NewSplitChangesCollection(db DBWrapper, logger logging.LoggerInterface) *SplitChangesCollection
NewSplitChangesCollection returns an instance of SplitChangesCollection
func (*SplitChangesCollection) ChangeNumber ¶
func (c *SplitChangesCollection) ChangeNumber() int64
ChangeNumber returns changeNumber
type SplitChangesItem ¶
type SplitChangesItem struct { ChangeNumber int64 `json:"changeNumber"` Name string `json:"name"` Status string `json:"status"` JSON string }
SplitChangesItem represents an SplitChanges service response
type SplitsChangesItems ¶
type SplitsChangesItems []SplitChangesItem
SplitsChangesItems Sortable list
func (SplitsChangesItems) Len ¶
func (slice SplitsChangesItems) Len() int
func (SplitsChangesItems) Less ¶
func (slice SplitsChangesItems) Less(i, j int) bool
func (SplitsChangesItems) Swap ¶
func (slice SplitsChangesItems) Swap(i, j int)