stategate_client_go

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 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

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

CacheClient is a stategate CacheService gRPC client

func NewCacheClient

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

NewCacheClient creates a new stategate CacheService client

func (*CacheClient) Close

func (c *CacheClient) Close() error

Close closes the gRPC client connection

func (*CacheClient) Del

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

func (*CacheClient) Get

func (*CacheClient) Set

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

type ClientSet

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

ClientSet holds an EntityClient, EventClient, and PeerClient

func NewClientSet

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

NewClientSet returns an initialized ClientSet

func (*ClientSet) Cache

func (c *ClientSet) Cache() *CacheClient

Cache returns the clientset's CacheService client

func (*ClientSet) Close

func (c *ClientSet) Close() error

Close closes the underlying connection

func (*ClientSet) Entity

func (c *ClientSet) Entity() *EntityClient

Entity returns the clientset's EntityService client

func (*ClientSet) Event

func (c *ClientSet) Event() *EventClient

Event returns the clientset's EventService client

func (*ClientSet) Mutex

func (c *ClientSet) Mutex() *MutexClient

Mutex returns the clientset's MutexService client

func (*ClientSet) Peer

func (c *ClientSet) Peer() *PeerClient

Peer returns the clientset's PeerService client

type EntityClient

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

EntityClient is a stategate EntityService gRPC client

func NewEntityClient

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

NewEntityClient creates a new stategate EntityService client

func (*EntityClient) Close

func (c *EntityClient) Close() error

Close closes the gRPC client connection

func (*EntityClient) Del

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

func (*EntityClient) Edit

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

Get gets an entity's current state

func (*EntityClient) Revert

Revert reverts an Entity to a previous version of itself

func (*EntityClient) Search

Search queries the current state of entities

func (*EntityClient) Set

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

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

EventClient is a stategate EventService gRPC client

func NewEventClient

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

func (c *EventClient) Close() error

Close closes the gRPC client connection

func (*EventClient) Get

Get gets an existing Event

func (*EventClient) Search

Search queries historical events(changes to entities).

func (*EventClient) Stream

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

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

MutexClient is a stategate MutexService gRPC client

func NewMutexClient

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

NewMutexClient creates a new stategate MutexService client

func (*MutexClient) Close

func (c *MutexClient) Close() error

Close closes the gRPC client connection

func (*MutexClient) Lock

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

func (*MutexClient) Unlock

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

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

PeerClient is a stategate PeerService gRPC client

func NewPeerClient

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

NewPeerClient creates a new stategate PeerService client

func (PeerClient) Broadcast

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

func (c *PeerClient) Close() error

Close closes the gRPC client connection

func (PeerClient) Stream

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