Documentation ¶
Index ¶
Constants ¶
View Source
const Type primitive.Type = "List"
Type is the list type
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // GetList gets the List instance of the given name GetList(ctx context.Context, name string) (List, error) }
Client provides an API for creating Lists
type Event ¶
type Event struct { // Type indicates the event type Type EventType // Index is the index at which the event occurred Index int // Value is the value that was changed Value []byte }
Event is a list change event
type List ¶
type List interface { primitive.Primitive // Append pushes a value on to the end of the list Append(ctx context.Context, value []byte) error // Insert inserts a value at the given index Insert(ctx context.Context, index int, value []byte) error // Set sets the value at the given index Set(ctx context.Context, index int, value []byte) error // Get gets the value at the given index Get(ctx context.Context, index int) ([]byte, error) // Remove removes and returns the value at the given index Remove(ctx context.Context, index int) ([]byte, error) // Len gets the length of the list Len(ctx context.Context) (int, error) // Slice returns a slice of the list from the given start index to the given end index Slice(ctx context.Context, from int, to int) (List, error) // SliceFrom returns a slice of the list from the given index SliceFrom(ctx context.Context, from int) (List, error) // SliceTo returns a slice of the list to the given index SliceTo(ctx context.Context, to int) (List, error) // Items iterates through the values in the list // This is a non-blocking method. If the method returns without error, values will be pushed on to the // given channel and the channel will be closed once all values have been read from the list. Items(ctx context.Context, ch chan<- []byte) error // Watch watches the list for changes // This is a non-blocking method. If the method returns without error, list events will be pushed onto // the given channel. Watch(ctx context.Context, ch chan<- *Event, opts ...WatchOption) error // Clear removes all values from the list Clear(ctx context.Context) error }
List provides a distributed list data structure The list values are defines as strings. To store more complex types in the list, 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 list Watch calls
Click to show internal directories.
Click to hide internal directories.