Documentation ¶
Index ¶
- type Cache
- func (cache *Cache) Close()
- func (cache *Cache) Evict()
- func (cache *Cache) Lookup(ctx context.Context, guid uuid.UUID, tracker dfsr.Tracker) (vector *Vector, call callstat.Call, err error)
- func (cache *Cache) Set(guid uuid.UUID, vector *Vector, call callstat.Call)
- func (cache *Cache) Value(guid uuid.UUID) (vector *Vector, call callstat.Call, ok bool)
- type Lookup
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a threadsafe expiring cache of version vectors that is capable of passing through cache misses to a lookup function.
func NewCache ¶
NewCache returns a new version vector cache with the given cache duration and value lookup function.
func (*Cache) Close ¶
func (cache *Cache) Close()
Close will release any resources consumed by the cache and its contents. It will also prevent further use of the cache.
func (*Cache) Evict ¶
func (cache *Cache) Evict()
Evict will expuge all existing values from the cache. Outstanding lookups that are still pending will not be affected.
func (*Cache) Lookup ¶
func (cache *Cache) Lookup(ctx context.Context, guid uuid.UUID, tracker dfsr.Tracker) (vector *Vector, call callstat.Call, err error)
Lookup returns the cached vector for the given GUID if it exists in the cache and has not expired. If the cached value is missing or expired, a lookup will be performed.
If the cache has been closed then ErrClosed will be returned.
func (*Cache) Set ¶
Set adds the vector to the cache for the given GUID. If a value already exists in the cache for that GUID, the existing value is replaced.
If the cache has been closed then Set will do nothing.
type Lookup ¶
type Lookup func(ctx context.Context, guid uuid.UUID, tracker dfsr.Tracker) (vector *Vector, call callstat.Call, err error)
Lookup defines a version vector lookup function.
type Vector ¶
type Vector struct {
// contains filtered or unexported fields
}
Vector represents version vector data from a replication group member.
func (*Vector) Close ¶
func (vector *Vector) Close()
Close will release any resources consumed by the version vector. It should be called when finished with the version vector.