value

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Type primitive.Type = "Value"

Type is the value type

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetValue gets the Value instance of the given name
	GetValue(ctx context.Context, name string, opts ...primitive.Option) (Value, error)
}

Client provides an API for creating Values

type Event

type Event struct {
	meta.ObjectMeta

	// Type is the change event type
	Type EventType

	// Value is the updated value
	Value []byte
}

Event is a value change event

type EventType

type EventType string

EventType is the type of a set event

const (
	// EventUpdate indicates the value was updated
	EventUpdate EventType = "update"
)

type Option

type Option interface {
	primitive.Option
	// contains filtered or unexported methods
}

Option is a value option

type SetOption

type SetOption interface {
	// contains filtered or unexported methods
}

SetOption is an option for Set calls

func IfMatch

func IfMatch(object meta.Object) SetOption

IfMatch updates the value if the version matches the given version

type Value

type Value interface {
	primitive.Primitive

	// Set sets the current value and returns the version
	Set(ctx context.Context, value []byte, opts ...SetOption) (meta.ObjectMeta, error)

	// Get gets the current value and version
	Get(ctx context.Context) ([]byte, meta.ObjectMeta, error)

	// Watch watches the value for changes
	Watch(ctx context.Context, ch chan<- Event) error
}

Value provides a simple atomic value

func New

func New(ctx context.Context, name string, conn *grpc.ClientConn, opts ...primitive.Option) (Value, error)

New creates a new Lock primitive for the given partitions The value will be created in one of the given partitions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL