Documentation ¶
Index ¶
Constants ¶
const Type primitive.Type = "IndexedMap"
Type is the indexed map type
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // GetIndexedMap gets the IndexedMap instance of the given name GetIndexedMap(ctx context.Context, name string, opts ...primitive.Option) (IndexedMap, error) }
Client provides an API for creating IndexedMaps
type Entry ¶
type Entry struct { meta.ObjectMeta // Index is the unique, monotonically increasing, globally unique index of the entry. The index is static // for the lifetime of a key. Index Index // Key is the key of the pair Key string // Value is the value of the pair Value []byte }
Entry is an indexed key/value pair
type Event ¶
type Event struct { // Type indicates the change event type Type EventType // Entry is the event entry Entry Entry }
Event is a map change event
type EventType ¶
type EventType string
EventType is the type of a map event
const ( // EventInsert indicates a key was newly created in the map EventInsert EventType = "insert" // EventUpdate indicates the value of an existing key was changed EventUpdate EventType = "update" // EventRemove indicates a key was removed from the map EventRemove EventType = "remove" // EventReplay indicates an entry was replayed EventReplay EventType = "replay" )
type GetOption ¶
type GetOption interface {
// contains filtered or unexported methods
}
GetOption is an option for the Get method
type IndexedMap ¶
type IndexedMap interface { primitive.Primitive // Append appends the given key/value to the map Append(ctx context.Context, key string, value []byte) (*Entry, error) // Put appends the given key/value to the map Put(ctx context.Context, key string, value []byte) (*Entry, error) // Set sets the given index in the map Set(ctx context.Context, index Index, key string, value []byte, opts ...SetOption) (*Entry, error) // Get gets the value of the given key Get(ctx context.Context, key string, opts ...GetOption) (*Entry, error) // GetIndex gets the entry at the given index GetIndex(ctx context.Context, index Index, opts ...GetOption) (*Entry, error) // FirstIndex gets the first index in the map FirstIndex(ctx context.Context) (Index, error) // LastIndex gets the last index in the map LastIndex(ctx context.Context) (Index, error) // PrevIndex gets the index before the given index PrevIndex(ctx context.Context, index Index) (Index, error) // NextIndex gets the index after the given index NextIndex(ctx context.Context, index Index) (Index, error) // FirstEntry gets the first entry in the map FirstEntry(ctx context.Context) (*Entry, error) // LastEntry gets the last entry in the map LastEntry(ctx context.Context) (*Entry, error) // PrevEntry gets the entry before the given index PrevEntry(ctx context.Context, index Index) (*Entry, error) // NextEntry gets the entry after the given index NextEntry(ctx context.Context, index Index) (*Entry, error) // Remove removes a key from the map Remove(ctx context.Context, key string, opts ...RemoveOption) (*Entry, error) // RemoveIndex removes an index from the map RemoveIndex(ctx context.Context, index Index, opts ...RemoveOption) (*Entry, error) // Len returns the number of entries in the map Len(ctx context.Context) (int, error) // Clear removes all entries from the map Clear(ctx context.Context) error // Entries lists the entries in the map // This is a non-blocking method. If the method returns without error, key/value paids will be pushed on to the // given channel and the channel will be closed once all entries have been read from the map. Entries(ctx context.Context, ch chan<- Entry) error // Watch watches the map for changes // This is a non-blocking method. If the method returns without error, map events will be pushed onto // the given channel in the order in which they occur. Watch(ctx context.Context, ch chan<- Event, opts ...WatchOption) error }
IndexedMap is a distributed linked map
type MatchOption ¶
type MatchOption struct { SetOption RemoveOption // contains filtered or unexported fields }
MatchOption is an implementation of SetOption and RemoveOption to specify the version for concurrency control
func IfMatch ¶
func IfMatch(object meta.Object) MatchOption
IfMatch sets the required version for optimistic concurrency control
type NotSetOption ¶
type NotSetOption struct { }
NotSetOption is a SetOption that sets the value only if it's not already set
type RemoveOption ¶
type RemoveOption interface {
// contains filtered or unexported methods
}
RemoveOption is an option for the Remove method
type SetOption ¶
type SetOption interface {
// contains filtered or unexported methods
}
SetOption is an option for the Put method
type WatchOption ¶
type WatchOption interface {
// contains filtered or unexported methods
}
WatchOption is an option for the Watch method
func WithFilter ¶
func WithFilter(filter Filter) WatchOption
WithFilter returns a watch option that filters the watch events
func WithReplay ¶
func WithReplay() WatchOption
WithReplay returns a watch option that enables replay of watch events