storage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureStorage

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

AzureStorage manages saving archives to Azure Blob Storage

func (*AzureStorage) Archive

func (s *AzureStorage) Archive(items map[string]int) error

Archive saves the cache to Azure Blob Storage

type FileStorage

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

FileStorage manages writing archives to disk

func (*FileStorage) Archive

func (s *FileStorage) Archive(items map[string]int) error

Archive saves an archive to local disk

type HitStorage

type HitStorage interface {
	Archive(map[string]int) error
}

HitStorage is an interface for writing to a StoreType

func NewAzureStorage

func NewAzureStorage(accountName string, accountKey string, container string) (HitStorage, error)

NewAzureStorage creates a new AzureStorage from credentials

func NewFileStorage

func NewFileStorage(path string) (HitStorage, error)

NewFileStorage creates a new FileStorage from a path

func NewS3Storage

func NewS3Storage(accessKeyID string, secretAccessKey string, bucket string, region string, useRole bool) (HitStorage, error)

NewS3Storage creates a new S3Storage instance

type Record

type Record struct {
	Timestamp time.Time      `json:"timestamp"`
	Hits      map[string]int `json:"hits"`
}

Record represents the structure for an individual archive file

type S3Storage

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

S3Storage manages saving files to S3

func (*S3Storage) Archive

func (s *S3Storage) Archive(items map[string]int) error

Archive saves file to S3

type StoreType

type StoreType string

StoreType is a wrapper type around a string to create an enum of storage options

const (
	// File is a StoreType for saving to disk
	File StoreType = "file"
	// Azure is a StoreType for saving to Azure Blob Storage
	Azure StoreType = "azure"
	// S3 is a StoreType for saving to S3
	S3 StoreType = "s3"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳