storagesvc

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

README

StorageSvc

StorageSvc consists of 3 components

  • Storage http request handler
  • StowClient
  • ArchivePruner

StorageSvc

This is the HTTP handler that serves requests to :

  • upload archive into a storage
  • fetch an archive from storage
  • delete archive from storage

StowClient

This is the storage interface layer that interacts with stow package. It provides methods to:

  • write a file to storage
  • retrieve a file from storage
  • delete a file from storage
  • get all files on storage

ArchivePruner

This acts like a cron job to clean up orphaned archives from storage. By default configured to run every hour. The value can be set in Values.yaml to any preferred interval.

Documentation

Index

Constants

View Source
const (
	StorageTypeLocal StorageType = "local"
	PaginationSize   int         = 10
)

Variables

View Source
var (
	ErrNotFound                = errors.New("not found")
	ErrRetrievingItem          = errors.New("unable to retrieve item")
	ErrOpeningItem             = errors.New("unable to open item")
	ErrWritingFile             = errors.New("unable to write file")
	ErrWritingFileIntoResponse = errors.New("unable to copy item into http response")
)

Functions

This section is empty.

Types

type ArchivePruner

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

func MakeArchivePruner

func MakeArchivePruner(logger *zap.Logger, stowClient *StowClient, pruneInterval time.Duration) (*ArchivePruner, error)

func (*ArchivePruner) Start

func (pruner *ArchivePruner) Start()

Start starts a go routine that listens to a channel for archive IDs that need to deleted. Also wakes up at regular intervals to make a list of archive IDs that need to be reaped and sends them over to the channel for deletion

type StorageService

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

func MakeStorageService

func MakeStorageService(logger *zap.Logger, storageClient *StowClient, port int) *StorageService

func RunStorageService

func RunStorageService(logger *zap.Logger, storageType StorageType, storagePath string, containerName string, port int, enablePruner bool) *StorageService

func (*StorageService) Start

func (ss *StorageService) Start(port int)

type StorageType

type StorageType string

type StowClient

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

func MakeStowClient

func MakeStowClient(logger *zap.Logger, storageType StorageType, storagePath string, containerName string) (*StowClient, error)

type UploadResponse

type UploadResponse struct {
	ID string `json:"id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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