Documentation
¶
Index ¶
Constants ¶
View Source
const Type primitive.Type = "Set"
Type is the set type
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// GetSet gets the Set instance of the given name
GetSet(ctx context.Context, name string) (Set, error)
}
Client provides an API for creating Sets
type Event ¶
type Event struct {
// Type is the change event type
Type EventType
// Value is the value that changed
Value string
}
Event is a set change event
type Set ¶
type Set interface {
primitive.Primitive
// Add adds a value to the set
Add(ctx context.Context, value string) (bool, error)
// Remove removes a value from the set
// A bool indicating whether the set contained the given value will be returned
Remove(ctx context.Context, value string) (bool, error)
// Contains returns a bool indicating whether the set contains the given value
Contains(ctx context.Context, value string) (bool, error)
// Len gets the set size in number of elements
Len(ctx context.Context) (int, error)
// Clear removes all values from the set
Clear(ctx context.Context) error
// Elements lists the elements in the set
Elements(ctx context.Context, ch chan<- string) error
// Watch watches the set for changes
// This is a non-blocking method. If the method returns without error, set events will be pushed onto
// the given channel.
Watch(ctx context.Context, ch chan<- *Event, opts ...WatchOption) error
}
Set provides a distributed set data structure The set values are defines as strings. To store more complex types in the set, encode values to strings e.g. using base 64 encoding.
type WatchOption ¶
type WatchOption interface {
// contains filtered or unexported methods
}
WatchOption is an option for set Watch calls
Click to show internal directories.
Click to hide internal directories.