archiver

package
v0.0.0-...-7b2e207 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: AGPL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BucketName = os.Getenv("REPO_ARCHIVE_BKT")

BucketName is the name of the google cloud repo

View Source
var PersisterProjectID = os.Getenv("GCP_PROJECT_ID")

PersisterProjectID is the google cloud project id

Functions

func MakeArchiveName

func MakeArchiveName(cocoonID, versionID string) string

MakeArchiveName creates name to be used for archiving a cocooon code release

Types

type Archiver

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

Archiver provides a structure that collects and object and saves using a Persister implementation

func NewArchiver

func NewArchiver(o Object, p Persister) *Archiver

NewArchiver creates a new archiver

func (*Archiver) Do

func (a *Archiver) Do() error

Do archives the object using the persister implementation

type GStoragePersister

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

GStoragePersister defines a structure that implements the Persister interface for storing objects on google cloud storage.

func NewGStoragePersister

func NewGStoragePersister(name string) (*GStoragePersister, error)

NewGStoragePersister creates a new google storage persister

func (*GStoragePersister) Commit

func (g *GStoragePersister) Commit() error

Commit saves the object

func (*GStoragePersister) Write

func (g *GStoragePersister) Write(ctx context.Context, p []byte) error

Write data into the object

type GitObject

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

GitObject defines a structure for fetching a git object

func NewGitObject

func NewGitObject(url, version string) *GitObject

NewGitObject creates a git object

func (*GitObject) Read

func (o *GitObject) Read(cb func(d []byte) error) error

Read fetches the git repository and passes the contents to the callback

type Object

type Object interface {

	// Read calls the callback with byte chunks of the object.
	// The implementation must stop and return any error returned by the callback
	Read(func(d []byte) error) error
}

Object defines a struct for collecting objects to archive

type Persister

type Persister interface {

	// Write collects the data to persist
	Write(context.Context, []byte) error

	// Commit sends the data to the storage
	Commit() error
}

Persister provides a structure to archive an object

Jump to

Keyboard shortcuts

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