store

package
v0.0.0-...-9c0d32c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitKeyValue

func InitKeyValue(
	ctx context.Context,
	conn *nats.Conn,
	opts ...StoreOption,
) error

Types

type ApplyRequest

type ApplyRequest struct {
	// Data is the actual JSON payload.
	Data []byte
	// Manager is the name of the field manager for this request.
	Manager string
	// Force will force the apply to happen even if there are conflicts.
	Force bool
	Key   hz.ObjectKeyer
}

type CreateRequest

type CreateRequest struct {
	Key  hz.ObjectKeyer
	Data []byte
}

type DeleteRequest

type DeleteRequest struct {
	Key hz.ObjectKeyer
}

type DeleteResult

type DeleteResult int
const (
	DeleteResultSuccess DeleteResult = iota
	DeleteResultError
	DeleteResultFinalizers
)

type GarbageCollector

type GarbageCollector struct {
	Conn *nats.Conn
	KV   jetstream.KeyValue
	// contains filtered or unexported fields
}

func (*GarbageCollector) Start

func (gc *GarbageCollector) Start(ctx context.Context) error

func (*GarbageCollector) Stop

func (gc *GarbageCollector) Stop()

type GetRequest

type GetRequest struct {
	Key hz.ObjectKeyer
}

type ListRequest

type ListRequest struct {
	Key hz.ObjectKeyer `json:"key,omitempty"`
}

type SchemaRequest

type SchemaRequest struct{}

type Store

type Store struct {
	Conn *nats.Conn
	Auth *auth.Auth
	// contains filtered or unexported fields
}

func StartStore

func StartStore(
	ctx context.Context,
	conn *nats.Conn,
	auth *auth.Auth,
	opts ...StoreOption,
) (*Store, error)

func (*Store) Apply

func (s *Store) Apply(ctx context.Context, req ApplyRequest) (int, error)

Apply performs the apply operation on the given request. It returns an HTTP status code (int) indicating the result of the operation. If an error is returned, the HTTP status code is part of the error and hence the return value is ignored (use -1 for consistency).

func (*Store) Close

func (s *Store) Close() error

func (*Store) Create

func (s *Store) Create(ctx context.Context, req CreateRequest) error

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, req DeleteRequest) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, req GetRequest) ([]byte, error)

func (*Store) List

func (s *Store) List(
	ctx context.Context,
	req ListRequest,
) (*hz.ObjectList, error)

func (*Store) Schema

func (s *Store) Schema(ctx context.Context, req SchemaRequest) error

func (*Store) Start

func (s *Store) Start(
	ctx context.Context,
	conn *nats.Conn,
	auth *auth.Auth,
	opts ...StoreOption,
) error

func (*Store) Update

func (s *Store) Update(ctx context.Context, req UpdateRequest) error

func (*Store) Validate

func (s *Store) Validate(ctx context.Context, req ValidateRequest) error

type StoreCommand

type StoreCommand string
const (
	StoreCommandCreate StoreCommand = "create"
	StoreCommandApply  StoreCommand = "apply"
	StoreCommandGet    StoreCommand = "get"
	StoreCommandList   StoreCommand = "list"
	StoreCommandDelete StoreCommand = "delete"
)

func (StoreCommand) String

func (c StoreCommand) String() string

type StoreOption

type StoreOption func(*storeOptions)

func WithMutexTTL

func WithMutexTTL(ttl time.Duration) StoreOption

func WithStopTimeout

func WithStopTimeout(timeout time.Duration) StoreOption

type UpdateRequest

type UpdateRequest struct {
	Data     []byte
	Key      hz.ObjectKeyer
	Revision uint64
}

type ValidateRequest

type ValidateRequest struct{}

Jump to

Keyboard shortcuts

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