stategate_client_go

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 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 CacheClient added in v0.9.0

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

CacheClient is a stategate CacheService gRPC client

func NewCacheClient added in v0.9.0

func NewCacheClient(ctx context.Context, target string, opts ...Opt) (*CacheClient, error)

NewCacheClient creates a new stategate CacheService client

func (*CacheClient) Close added in v0.9.0

func (c *CacheClient) Close() error

Close closes the gRPC client connection

func (*CacheClient) Del added in v0.9.0

func (m *CacheClient) Del(ctx context.Context, ref *stategate.CacheRef) error

func (*CacheClient) Get added in v0.9.0

func (*CacheClient) Set added in v0.9.0

func (m *CacheClient) Set(ctx context.Context, value *stategate.Cache) error

type ClientSet added in v0.8.0

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

ClientSet holds an EntityClient, EventClient, and PeerClient

func NewClientSet added in v0.8.0

func NewClientSet(ctx context.Context, target string, opts ...Opt) (*ClientSet, error)

NewClientSet returns an initialized ClientSet

func (*ClientSet) Cache added in v0.9.0

func (c *ClientSet) Cache() *CacheClient

Cache returns the clientset's CacheService client

func (*ClientSet) Close added in v0.8.0

func (c *ClientSet) Close() error

Close closes the underlying connection

func (*ClientSet) Entity added in v0.8.0

func (c *ClientSet) Entity() *EntityClient

Entity returns the clientset's EntityService client

func (*ClientSet) Event added in v0.8.0

func (c *ClientSet) Event() *EventClient

Event returns the clientset's EventService client

func (*ClientSet) Mutex added in v0.9.0

func (c *ClientSet) Mutex() *MutexClient

Mutex returns the clientset's MutexService client

func (*ClientSet) Peer added in v0.8.0

func (c *ClientSet) Peer() *PeerClient

Peer returns the clientset's PeerService client

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 EntityService 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

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

func (*EntityClient) Edit added in v0.6.1

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

Get gets an entity's current state

func (*EntityClient) Revert added in v0.6.2

Revert reverts an Entity to a previous version of itself

func (*EntityClient) Search added in v0.6.0

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 EventService 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

Get gets an existing Event

func (*EventClient) Search added in v0.4.0

Search queries historical events(changes to entities).

func (*EventClient) Stream added in v0.4.0

func (c *EventClient) Stream(ctx context.Context, in *stategate.StreamEventOpts, 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 MutexClient added in v0.9.0

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

MutexClient is a stategate MutexService gRPC client

func NewMutexClient added in v0.9.0

func NewMutexClient(ctx context.Context, target string, opts ...Opt) (*MutexClient, error)

NewMutexClient creates a new stategate MutexService client

func (*MutexClient) Close added in v0.9.0

func (c *MutexClient) Close() error

Close closes the gRPC client connection

func (*MutexClient) Lock added in v0.9.0

func (m *MutexClient) Lock(ctx context.Context, mutex *stategate.Mutex) error

func (*MutexClient) Unlock added in v0.9.0

func (m *MutexClient) Unlock(ctx context.Context, ref *stategate.MutexRef) error

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

type PeerClient added in v0.8.0

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

PeerClient is a stategate PeerService gRPC client

func NewPeerClient added in v0.8.0

func NewPeerClient(ctx context.Context, target string, opts ...Opt) (*PeerClient, error)

NewPeerClient creates a new stategate PeerService client

func (PeerClient) Broadcast added in v0.8.0

func (p PeerClient) Broadcast(ctx context.Context, in *stategate.Message) error

Broadcast broadcasts a message to N subscribers(PeerService clients calling Stream)

func (*PeerClient) Close added in v0.8.0

func (c *PeerClient) Close() error

Close closes the gRPC client connection

func (PeerClient) Stream added in v0.8.0

Stream consumes/streams messages from message producers(PeerService clients calling broadcast)

Jump to

Keyboard shortcuts

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