Index | Files

package archiver

import ""

Package archiver zips lots of little blobs into bigger zip files and stores them somewhere. While generic, it was designed to incrementally create Amazon Glacier archives from many little blobs, rather than creating millions of Glacier archives.


Package Files



const DefaultMinZipSize = 16 << 20

DefaultMinZipSize is the default value of Archiver.MinZipSize.


var ErrSourceTooSmall = errors.New("archiver: not enough blob data on source to warrant a new zip archive")

ErrSourceTooSmall is returned by RunOnce if there aren't enough blobs on Source to warrant a new zip archive.

type Archiver Uses

type Archiver struct {
    // Source is where the blobs should come from.
    // (and be deleted from, if DeleteSourceAfterStore)
    Source blobserver.Storage

    // MinZipSize is the minimum size of zip files to create.
    // If zero, DefaultMinZipSize is used.
    MinZipSize int64

    // Store specifies a function that writes the zip file
    // (encoded in the byte slice) to permanent storage
    // (e.g. Amazon Glacier) and notes somewhere (a database) that
    // it contains the listed blobs. The blobs are redundant with
    // the filenames in the zip file, which will be named by
    // their blobref string, with no extension.
    Store func(zip []byte, blobs []blob.SizedRef) error

    // DeleteSourceAfterStore, if true, deletes the blobs from Source
    // after Store returns success.
    // This should pretty much always be set true, otherwise subsequent
    // calls to Run/RunOnce will generate the same archives. Wrap
    // the Source in a "namespace" storage if you don't actually
    // want to delete things locally.
    DeleteSourceAfterStore bool

An Archiver specifies the parameters of the job that copies from one blobserver Storage (the Source) to long-term storage.

func (*Archiver) RunOnce Uses

func (a *Archiver) RunOnce(ctx context.Context) error

RunOnce scans a.Source and conditionally creates a new zip. It returns ErrSourceTooSmall if there aren't enough blobs on Source.

Package archiver imports 7 packages (graph). Updated 2019-06-27. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).