entityserver

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) Create

func (c *Client) Create(ctx context.Context, name string, sc SchemaEncoder, opts ...CreateOptions) (entity.Id, error)

func (*Client) CreateOrReplace added in v0.7.0

func (c *Client) CreateOrReplace(ctx context.Context, name string, sc SchemaEncoder, opts ...CreateOptions) (entity.Id, error)

CreateOrReplace creates a new entity or fully replaces an existing one. Unlike CreateOrUpdate which merges attrs (appending to "many" component fields), this method replaces all attrs atomically when the entity exists. Note: not safe for concurrent use on the same entity — the Replace will fail with a revision mismatch if another writer updates between Get and Replace. This is fine for startup-time initialization but callers needing concurrent safety should add retry logic.

func (*Client) CreateOrUpdate

func (c *Client) CreateOrUpdate(ctx context.Context, name string, sc SchemaEncoder, opts ...CreateOptions) (entity.Id, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id entity.Id) error

func (*Client) EAC added in v0.4.0

EAC returns the underlying EntityAccessClient.

func (*Client) Get

func (c *Client) Get(ctx context.Context, name string, sc SchemaEncoder) error

func (*Client) GetById

func (c *Client) GetById(ctx context.Context, id entity.Id, sc SchemaEncoder) error

func (*Client) GetByIdWithEntity

func (c *Client) GetByIdWithEntity(ctx context.Context, id entity.Id, sc SchemaEncoder) (*entityserver_v1alpha.Entity, error)

func (*Client) List

func (c *Client) List(ctx context.Context, index entity.Attr) (*ListResults, error)

func (*Client) NewSession

func (c *Client) NewSession(ctx context.Context, usage string) (*Session, *Client, error)

Grant creates a new lease with the given TTL

func (*Client) OneAtIndex

func (c *Client) OneAtIndex(ctx context.Context, index entity.Attr, sc SchemaEncoder) error

func (*Client) Patch added in v0.3.0

func (c *Client) Patch(ctx context.Context, id entity.Id, revision int64, attrs ...entity.Attr) error

Patch updates specific attributes on an entity without replacing the entire entity. Pass revision 0 to skip optimistic concurrency control, or a specific revision to ensure the entity hasn't been modified since it was read.

func (*Client) Update

func (c *Client) Update(ctx context.Context, sc SchemaEncoderWithId) error

func (*Client) UpdateAttrs

func (c *Client) UpdateAttrs(ctx context.Context, id entity.Id, attrs ...any) error

func (*Client) WatchEntity

func (c *Client) WatchEntity(ctx context.Context, id entity.Id) chan *entity.Entity

type CreateOptions

type CreateOptions func(o *createOp)

func WithLabels

func WithLabels(labels types.Labels) CreateOptions

type ListResults

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

func (*ListResults) Entity

func (l *ListResults) Entity() *entity.Entity

func (*ListResults) Length

func (l *ListResults) Length() int

func (*ListResults) Metadata

func (l *ListResults) Metadata() *core_v1alpha.Metadata

func (*ListResults) Next

func (l *ListResults) Next() bool

func (*ListResults) Read

func (l *ListResults) Read(sc SchemaEncoder) error

type SchemaEncoder

type SchemaEncoder interface {
	ShortKind() string
	Kind() entity.Id
	Encode() []entity.Attr
	Decode(e entity.AttrGetter)
}

type SchemaEncoderWithId

type SchemaEncoderWithId interface {
	SchemaEncoder
	EntityId() entity.Id
}

type Session

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

func (*Session) Close

func (l *Session) Close() error

func (*Session) Ping

func (l *Session) Ping(ctx context.Context) error

Assert keeps the lease alive

func (*Session) Revoke

func (l *Session) Revoke(ctx context.Context) error

Revoke revokes the lease

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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