Documentation ¶
Index ¶
- type CleanFunc
- type CloneFunc
- type HashStore
- type ListItem
- type ListStore
- type ListStoreImpl
- func (s *ListStoreImpl) ConditionRange(f StoreConditionRangeFunc) bool
- func (s *ListStoreImpl) Delete(key string)
- func (s *ListStoreImpl) Front() *ListItem
- func (s *ListStoreImpl) Get(key string) StoredObj
- func (s *ListStoreImpl) HashStore() HashStore
- func (s *ListStoreImpl) Len() int
- func (s *ListStoreImpl) Range(f StoreRangeFunc)
- func (s *ListStoreImpl) Set(key string, obj StoredObj)
- func (s *ListStoreImpl) String() string
- func (s *ListStoreImpl) UpdateRawStore(store RawStore, cloneFunc CloneFunc, cleanFunc CleanFunc)
- type RawStore
- type RawStoreImpl
- func (s *RawStoreImpl) ConditionRange(f StoreConditionRangeFunc) bool
- func (s *RawStoreImpl) Delete(key string)
- func (s *RawStoreImpl) Get(key string) StoredObj
- func (s *RawStoreImpl) GetGeneration() uint64
- func (s *RawStoreImpl) Len() int
- func (s *RawStoreImpl) Range(f StoreRangeFunc)
- func (s *RawStoreImpl) ResetUpdatedSet()
- func (s *RawStoreImpl) Set(key string, obj StoredObj)
- func (s *RawStoreImpl) SetGeneration(generation uint64)
- func (s *RawStoreImpl) String() string
- func (s *RawStoreImpl) UpdatedSet() sets.String
- type Store
- type StoreConditionRangeFunc
- type StoreRangeFunc
- type StoredObj
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CleanFunc ¶
type CleanFunc func()
CleanFunc defines the cleanup function used in UpdateRawStore.
func DefaultCleanFunc ¶
type ListItem ¶
type ListItem struct { StoredObj // contains filtered or unexported fields }
------------------- ListItem -------------------
type ListStore ¶
ListStore defines the methods of ListStore.
func NewListStore ¶
func NewListStore() ListStore
type ListStoreImpl ¶
type ListStoreImpl struct {
// contains filtered or unexported fields
}
ListStoreImpl implement the ListStore interface. We will store all the objects in hashmap and linked-list, and maintain the StoredObj's generation according to ListStoreImpl.generation. And the linked-list will be organized in descending order of generation.
func (*ListStoreImpl) ConditionRange ¶
func (s *ListStoreImpl) ConditionRange(f StoreConditionRangeFunc) bool
func (*ListStoreImpl) Delete ¶
func (s *ListStoreImpl) Delete(key string)
func (*ListStoreImpl) Front ¶
func (s *ListStoreImpl) Front() *ListItem
func (*ListStoreImpl) Get ¶
func (s *ListStoreImpl) Get(key string) StoredObj
func (*ListStoreImpl) HashStore ¶
func (s *ListStoreImpl) HashStore() HashStore
func (*ListStoreImpl) Len ¶
func (s *ListStoreImpl) Len() int
func (*ListStoreImpl) Range ¶
func (s *ListStoreImpl) Range(f StoreRangeFunc)
func (*ListStoreImpl) Set ¶
func (s *ListStoreImpl) Set(key string, obj StoredObj)
Set will update the ListItem if it has been existed, or create a new ListItem to hold it. The ListStoreImpl.generation will be updated and the ListItem will be moved to head.
func (*ListStoreImpl) String ¶
func (s *ListStoreImpl) String() string
func (*ListStoreImpl) UpdateRawStore ¶
func (s *ListStoreImpl) UpdateRawStore(store RawStore, cloneFunc CloneFunc, cleanFunc CleanFunc)
UpdateRawStore update RawStore according the generation. We will update the RawStore by linked-list firstly, and by RawStore.UpdatedSet. Finally refresh the RawStore.generation and do cleanup.
type RawStore ¶
type RawStore interface { Store SetGeneration(uint64) GetGeneration() uint64 UpdatedSet() sets.String ResetUpdatedSet() }
RawStore defines the methods of RawStore.
func NewRawStore ¶
func NewRawStore() RawStore
type RawStoreImpl ¶
type RawStoreImpl struct {
// contains filtered or unexported fields
}
RawStoreImpl implement the RawStore interface. StoredObj will be stored in a raw hashmap, and RawStoreImpl.generation hold the max-generation of these items.
func (*RawStoreImpl) ConditionRange ¶
func (s *RawStoreImpl) ConditionRange(f StoreConditionRangeFunc) bool
func (*RawStoreImpl) Delete ¶
func (s *RawStoreImpl) Delete(key string)
func (*RawStoreImpl) Get ¶
func (s *RawStoreImpl) Get(key string) StoredObj
func (*RawStoreImpl) GetGeneration ¶
func (s *RawStoreImpl) GetGeneration() uint64
func (*RawStoreImpl) Len ¶
func (s *RawStoreImpl) Len() int
func (*RawStoreImpl) Range ¶
func (s *RawStoreImpl) Range(f StoreRangeFunc)
func (*RawStoreImpl) ResetUpdatedSet ¶
func (s *RawStoreImpl) ResetUpdatedSet()
func (*RawStoreImpl) Set ¶
func (s *RawStoreImpl) Set(key string, obj StoredObj)
func (*RawStoreImpl) SetGeneration ¶
func (s *RawStoreImpl) SetGeneration(generation uint64)
func (*RawStoreImpl) String ¶
func (s *RawStoreImpl) String() string
func (*RawStoreImpl) UpdatedSet ¶
func (s *RawStoreImpl) UpdatedSet() sets.String
type Store ¶
type Store interface { Get(string) StoredObj Set(string, StoredObj) Delete(string) Len() int Range(StoreRangeFunc) ConditionRange(StoreConditionRangeFunc) bool String() string }
Store defines the field that the some-datastructure will hold if it need generatestore. The Store field's real object is either ListStore or RawStore.