spanner

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetInstance gets the instance by instance id.
	GetInstance(ctx context.Context) (*Instance, error)
	// GetInstanceMetrics updates the instance whose provided instance id.
	UpdateInstance(ctx context.Context, instance *Instance) error
}

Client is a client for manipulation of Instance.

func NewClient

func NewClient(ctx context.Context, projectID, instanceID string, opts ...Option) (Client, error)

NewClient returns a new Client.

type FakeClient

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

FakeClient implements Client but operates fake objects for testing. This ensure thread-safety.

func NewFakeClient

func NewFakeClient(instance *Instance) *FakeClient

NewFakeClient returns a new *FakeClient initialized with the given fake objects.

func (*FakeClient) GetInstance

func (c *FakeClient) GetInstance(ctx context.Context) (*Instance, error)

GetInstance implements Client.

func (*FakeClient) UpdateInstance

func (c *FakeClient) UpdateInstance(ctx context.Context, instance *Instance) error

UpdateInstance implements Client.

type Instance

type Instance struct {
	ProcessingUnits int
	InstanceState   State
}

Instance represents Spanner Instance.

type Option

type Option func(*client)

func WithLog

func WithLog(log logr.Logger) Option

func WithTokenSource

func WithTokenSource(ts oauth2.TokenSource) Option

type State

Jump to

Keyboard shortcuts

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