Skip to content

package gcs

import "github.com/cloudboss/unobin/pkg/state/gcs"

Package gcs stores state snapshots in Google Cloud Storage.

Functions

func NewClient

func NewClient(service *storage.Service, bucket string) client

NewClient returns a GCS client backed by the Google Storage REST API.

Types

type Store

type Store struct {
    Bucket     string
    Prefix     string
    KMSKeyName string
    // contains filtered or unexported fields
}

Store reads and writes snapshots under a per-stack key prefix.

func NewStore

func NewStore(
    client client,
    bucket, prefix, kmsKeyName, factory, stack string,
    enc sdkencrypt.Encrypter,
) (*Store, error)

NewStore returns a Store for factory and stack in bucket.

func (*Store) Current

func (s *Store) Current() (*sdkstate.Snapshot, error)

func (*Store) CurrentRev

func (s *Store) CurrentRev() (string, error)

func (*Store) Delete

func (s *Store) Delete(rev string) error

func (*Store) ForceUnlock

func (s *Store) ForceUnlock() error

func (*Store) Get

func (s *Store) Get(rev string) (*sdkstate.Snapshot, error)

func (*Store) List

func (s *Store) List() ([]string, error)

func (*Store) Lock

func (s *Store) Lock(ctx context.Context) (sdkstate.Lock, error)

func (*Store) SetCurrent

func (s *Store) SetCurrent(rev string) error

func (*Store) Stack

func (s *Store) Stack() string

func (*Store) Write

func (s *Store) Write(snap *sdkstate.Snapshot) (string, error)