gcs

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gcs contains an implementation of RaceDecider (plus helpers) for using Google Cloud Storage as a backend in leader-election.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decider

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

Decider implements leaderelection.RaceDecider using a specific object in a specific bucket for persistence

func NewDecider

func NewDecider(client *storage.Client, bucket, object string, opts ...DeciderOpts) *Decider

NewDecider creates a new gcs.Decider

func (*Decider) ReadCurrent

func (d *Decider) ReadCurrent(ctx context.Context) (*entry.RaceEntry, error)

ReadCurrent should provide the latest version of RaceEntry available and put any additional information needed to ensure transactional behavior in the Token-field.

func (*Decider) WriteEntry

func (d *Decider) WriteEntry(ctx context.Context, rentry *entry.RaceEntry) (entry.LeaderToken, error)

WriteEntry implementations should write the entry argument to stable-storage in a transactional-way such that only one contender wins per-election/term

type DeciderOpts added in v0.2.0

type DeciderOpts func(*deciderOptions)

DeciderOpts configures a GCS RaceDecider at construction-time

func WithACLEntry added in v0.2.0

func WithACLEntry(rule storage.ACLRule) DeciderOpts

WithACLEntry appends a ACL Rule to the ACL that will be set on new object versions written by this RaceDecider.

func WithObjectReader added in v0.2.0

func WithObjectReader(reader storage.ACLEntity) DeciderOpts

WithObjectReader appends a rule granting readonly access to the ACL entity argument to the ACL that will be set on new object versions written by this RaceDecider.

Jump to

Keyboard shortcuts

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