spannerauth

package
v1.90.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error is a class of spannerauth errors.
	Error = errs.Class("spannerauth")
)

Functions

func EmulatorOpts

func EmulatorOpts(addr string) []option.ClientOption

EmulatorOpts returns ClientOptions for Cloud Spanner Emulator.

Types

type CloudDatabase

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

CloudDatabase represents a remote Cloud Spanner database that implements the Storage interface.

func Open

func Open(ctx context.Context, logger *zap.Logger, config Config) (*CloudDatabase, error)

Open returns initialized CloudDatabase connected to Cloud Spanner. If address is specified in config, it configures options for Cloud Spanner Emulator.

func (*CloudDatabase) Close

func (d *CloudDatabase) Close() error

Close closes the remote Cloud Spanner database.

func (*CloudDatabase) Delete added in v1.67.0

func (d *CloudDatabase) Delete(ctx context.Context, keyHash authdb.KeyHash) (err error)

Delete deletes the record.

func (*CloudDatabase) Get

func (d *CloudDatabase) Get(ctx context.Context, keyHash authdb.KeyHash) (_ *authdb.Record, err error)

Get retrieves the record from the remote Cloud Spanner database. It returns (nil, nil) if the key does not exist. If the record is invalid, the error contains why.

func (*CloudDatabase) GetFullRecord added in v1.69.0

func (d *CloudDatabase) GetFullRecord(ctx context.Context, keyHash authdb.KeyHash) (_ *authdb.FullRecord, err error)

GetFullRecord retrieves the record from the remote Cloud Spanner database. It returns (nil, nil) if the key does not exist.

func (*CloudDatabase) HealthCheck

func (d *CloudDatabase) HealthCheck(ctx context.Context) error

HealthCheck ensures there's connectivity to the remote Cloud Spanner database and returns an error otherwise.

func (*CloudDatabase) Invalidate added in v1.67.0

func (d *CloudDatabase) Invalidate(ctx context.Context, keyHash authdb.KeyHash, reason string) (err error)

Invalidate invalidates the record.

func (*CloudDatabase) Put

func (d *CloudDatabase) Put(ctx context.Context, keyHash authdb.KeyHash, record *authdb.Record) (err error)

Put stores the record in the remote Cloud Spanner database. It is an error if the key already exists.

func (*CloudDatabase) Unpublish added in v1.67.0

func (d *CloudDatabase) Unpublish(ctx context.Context, keyHash authdb.KeyHash) (err error)

Unpublish unpublishes the record.

type Config

type Config struct {
	DatabaseName        string `user:"true" help:"name of Cloud Spanner database in the form projects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID"`
	CredentialsFilename string `user:"true" help:"credentials file with access to Cloud Spanner database"`

	// Address is used for Cloud Spanner Emulator in tests.
	Address string `internal:"true"`
}

Config is config to configure the Cloud Spanner database.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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