cache

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Update *Update
	Delete []string
}

type Client

type Client interface {
	// create a cache
	Create(ctx context.Context, name string, ephemeral bool, cached bool) error
	// list caches
	List(ctx context.Context) ([]string, error)
	// delete cache or cache candidate
	Delete(ctx context.Context, name string) error
	// check if cache instance exists
	Exists(ctx context.Context, name string) (bool, error)
	// create a candidate
	CreateCandidate(ctx context.Context, name, candidate, owner string, priority int32) error
	// get list of candidates
	GetCandidates(ctx context.Context, name string) ([]*cache.CandidateDetails, error)
	// check if a candidate exists
	HasCandidate(ctx context.Context, name, candidate string) (bool, error)
	// deletes a candidate
	DeleteCandidate(ctx context.Context, name, candidate string) error
	// clone a cache
	Clone(ctx context.Context, name, clone string) error
	//
	CreatePruneID(ctx context.Context, name string, force bool) (string, error)
	//
	ApplyPrune(ctx context.Context, name, id string) error
	// send a stream of modifications (update or delete) to a cache, or candidate
	Modify(ctx context.Context, name string, opts *Opts, dels [][]string, upds []*Update) error
	// read from a cache or candidate
	Read(ctx context.Context, name string, opts *Opts, paths [][]string, period time.Duration) []*Update
	// read from a cache or candidate, get results through a channel
	ReadCh(ctx context.Context, name string, opts *Opts, paths [][]string, period time.Duration) chan *Update
	// get changes present in a candidate
	GetChanges(ctx context.Context, name, candidate string) ([]*Change, error)
	// discard changes made to a candidate
	Discard(ctx context.Context, name, candidate string) error
	// commit a candidate changes into the intended store
	Commit(ctx context.Context, name, candidate string) error
	// build a cache update from a sdcpb.Update
	NewUpdate(*sdcpb.Update) (*Update, error)
	// disconnect from the cache
	Close() error
}

func NewLocalCache

func NewLocalCache(cfg *config.CacheConfig) (Client, error)

func NewRemoteCache

func NewRemoteCache(ctx context.Context, addr string) (Client, error)

type Opts

type Opts struct {
	Store         cachepb.Store
	Owner         string
	Priority      int32
	PriorityCount uint64
	KeysOnly      bool
}

type Update

type Update struct {
	// contains filtered or unexported fields
}

func (*Update) Bytes

func (u *Update) Bytes() []byte

func (*Update) GetPath

func (u *Update) GetPath() []string

func (*Update) Owner

func (u *Update) Owner() string

func (*Update) Priority

func (u *Update) Priority() int32

func (*Update) TS

func (u *Update) TS() int64

func (*Update) Value

func (u *Update) Value() (*sdcpb.TypedValue, error)

Jump to

Keyboard shortcuts

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