stategate_client_go

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 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 EntityClient added in v0.6.0

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

EntityClient is a stategate EntityService gRPC client

func NewEntityClient added in v0.6.0

func NewEntityClient(ctx context.Context, target string, opts ...Opt) (*EntityClient, error)

NewEntityClient creates a new stategate state client

func (*EntityClient) Close added in v0.6.0

func (c *EntityClient) Close() error

Close closes the gRPC client connection

func (*EntityClient) Del added in v0.6.0

func (c *EntityClient) Del(ctx context.Context, in *stategate.EntityRef) error

Del deletes an application state value(k/v pairs)

func (*EntityClient) Edit added in v0.6.1

func (c *EntityClient) Edit(ctx context.Context, in *stategate.Entity) (*stategate.Entity, error)

Edit overwrites the k/v pairs present in the entity request without replacing the entire entity. It then adds the state change to the event log, then broadcast the event to all interested consumers(EventService.Stream)

func (*EntityClient) Get added in v0.6.0

func (c *EntityClient) Get(ctx context.Context, in *stategate.EntityRef) (*stategate.Entity, error)

Get gets an entity's current state

func (*EntityClient) Revert added in v0.6.2

func (c *EntityClient) Revert(ctx context.Context, in *stategate.EventRef) (*stategate.Entity, error)

Revert reverts an Entity to a previous version of itself

func (*EntityClient) Search added in v0.6.0

func (c *EntityClient) Search(ctx context.Context, in *stategate.SearchEntityOpts) (*stategate.Entities, error)

Search queries the current state of entities

func (*EntityClient) Set added in v0.6.0

func (c *EntityClient) Set(ctx context.Context, in *stategate.Entity) error

Set sets the current state value of an entity, adds it to the event log, then broadcast the event to all interested consumers

type EventClient added in v0.4.0

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

EventClient is a stategate EventService gRPC client

func NewEventClient added in v0.4.0

func NewEventClient(ctx context.Context, target string, opts ...Opt) (*EventClient, error)

NewEventClient creates a new stategate EntityService client EntityService serves API methods to clients that modify/query the current state of an entity An Entity is a single object with a type, domain, key, and k/v values

func (*EventClient) Close added in v0.4.0

func (c *EventClient) Close() error

Close closes the gRPC client connection

func (*EventClient) Get added in v0.7.0

func (c *EventClient) Get(ctx context.Context, in *stategate.EventRef) (*stategate.Event, error)

Get gets an existing Event

func (*EventClient) Search added in v0.4.0

func (c *EventClient) Search(ctx context.Context, in *stategate.SearchEventOpts) (*stategate.Events, error)

Search queries historical events(changes to entities).

func (*EventClient) Stream added in v0.4.0

func (c *EventClient) Stream(ctx context.Context, in *stategate.StreamOpts, fn func(even *stategate.Event) bool) error

Stream creates an event stream/subscription to changes to entities until fn returns false OR the context cancels.. Glob matching is supported.

type Opt

type Opt func(o *Options)

Opt is a single configuration option

func WithIDToken

func WithIDToken(idToken bool) Opt

WithIDToken makes the client use the oauth id token(if it exists) instead of the oauth access token

func WithLogging

func WithLogging(logging, logPayload bool) Opt

WithLogging registers a logging middleware

func WithMetrics

func WithMetrics(metrics bool) Opt

WithMetrics registers prometheus metrics

func WithTokenSource

func WithTokenSource(tokenSource oauth2.TokenSource) Opt

WithTokenSource uses oauth token add an authorization header to every outbound request

func WithTransportCreds

func WithTransportCreds(creds credentials.TransportCredentials) Opt

WithTransportCreds adds transport credentials to the client

type Options

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

Options holds configuration options

Jump to

Keyboard shortcuts

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