gcs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Bucket     string
	MaxRetries int
}

func (*Config) CreateStorage

func (conf *Config) CreateStorage(logger *log.Logger) (*Storage, error)

func (*Config) RegisterFlags

func (conf *Config) RegisterFlags(f *flag.FlagSet)

type Storage

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

Storage stores and loads profiles from gcs.

The schema for the object key: schemaV.service/profile_type/digest,label1=value1,label2=value2

Where "schemaV" indicates the naming schema that was used when the profile was stored; "digests" uniquely describes the profile, it also includes profiles creation time.

func NewStorage

func NewStorage(logger *log.Logger, client *gcs.Client, gcsBucket string) *Storage

func (*Storage) FindProfileIDs

func (st *Storage) FindProfileIDs(ctx context.Context, params *storage.FindProfilesParams) ([]profile.ID, error)

FindProfileIDs queries gcs for profile IDs matched searched criteria.

func (*Storage) FindProfiles

func (st *Storage) FindProfiles(ctx context.Context, params *storage.FindProfilesParams) ([]profile.Meta, error)

FindProfiles queries gcs for profile metas matched searched criteria.

func (*Storage) ListProfiles

func (st *Storage) ListProfiles(ctx context.Context, pids []profile.ID) (storage.ProfileList, error)

func (*Storage) ListServices

func (st *Storage) ListServices(ctx context.Context) ([]string, error)

ListServices returns the list of distinct services for which profiles are stored in the bucket.

func (*Storage) WriteProfile

func (st *Storage) WriteProfile(ctx context.Context, params *storage.WriteProfileParams, r io.Reader) (profile.Meta, error)

WriteProfile uploads the profile to gcs. Context can be canceled and this is safe for multiple goroutines.

Jump to

Keyboard shortcuts

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