binarylib

package
v0.0.0-...-ff5f600 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2016 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Overview

The implementation of the binary repository interface stores objects identified by object name suffixes using the local file system. Given an object name suffix, the implementation computes an MD5 hash of the suffix and generates the following path in the local filesystem: /<root-dir>/<dir_1>/.../<dir_n>/<hash>. The root directory and the directory depth are parameters of the implementation. <root-dir> also contains __acls/data and __acls/sig files storing the Permissions for the root level. The contents of the directory include the checksum and data for each of the individual parts of the binary, the name of the object and a directory containing the perms for this particular object:

name acls/data acls/sig mediainfo name <part_1>/checksum <part_1>/data ... <part_n>/checksum <part_n>/data

TODO(jsimsa): Add an "fsck" method that cleans up existing on-disk repository and provide a command-line flag that identifies whether fsck should run when new repository server process starts up.

Index

Constants

View Source
const (
	VersionFile = "VERSION"
	Version     = "1.0"
)
View Source
const BufferLength = 4096

Variables

View Source
var (
	ErrInProgress      = verror.Register(pkgPath+".errInProgress", verror.NoRetry, "{1:}{2:} identical upload already in progress{:_}")
	ErrInvalidParts    = verror.Register(pkgPath+".errInvalidParts", verror.NoRetry, "{1:}{2:} invalid number of binary parts{:_}")
	ErrInvalidPart     = verror.Register(pkgPath+".errInvalidPart", verror.NoRetry, "{1:}{2:} invalid binary part number{:_}")
	ErrOperationFailed = verror.Register(pkgPath+".errOperationFailed", verror.NoRetry, "{1:}{2:} operation failed{:_}")
	ErrNotAuthorized   = verror.Register(pkgPath+".errNotAuthorized", verror.NoRetry, "{1:}{2:} none of the client's blessings are valid {:_}")
	ErrInvalidSuffix   = verror.Register(pkgPath+".errInvalidSuffix", verror.NoRetry, "{1:}{2:} invalid suffix{:_}")
)
View Source
var MissingPart = binary.PartInfo{
	Checksum: binary.MissingChecksum,
	Size:     binary.MissingSize,
}

TODO(jsimsa): When VDL supports composite literal constants, remove this definition.

Functions

func Delete

func Delete(ctx *context.T, name string) error

func Download

func Download(ctx *context.T, von string) ([]byte, repository.MediaInfo, error)

func DownloadToFile

func DownloadToFile(ctx *context.T, von, path string) error

func DownloadUrl

func DownloadUrl(ctx *context.T, von string) (string, int64, error)

func NewDispatcher

func NewDispatcher(ctx *context.T, state *state) (rpc.Dispatcher, error)

NewDispatcher is the dispatcher factory.

func NewHTTPRoot

func NewHTTPRoot(ctx *context.T, state *state) http.FileSystem

NewHTTPRoot returns an implementation of http.FileSystem that can be used to serve the content in the binary service.

func NewState

func NewState(rootDir, rootURL string, depth int) (*state, error)

NewState creates a new state object for the binary service. This should be passed into both NewDispatcher and NewHTTPRoot.

func SetupRootDir

func SetupRootDir(root string) (string, error)

SetupRootDir sets up the root directory if it doesn't already exist. If an empty string is used as root, create a new temporary directory.

func Sign

func Sign(ctx *context.T, in io.Reader) (*security.Signature, error)

func Stat

func Stat(ctx *context.T, name string) (repository.MediaInfo, error)

func Upload

func Upload(ctx *context.T, von string, data []byte, mediaInfo repository.MediaInfo) (*security.Signature, error)

func UploadFromDir

func UploadFromDir(ctx *context.T, von, sourceDir string) (*security.Signature, error)

func UploadFromFile

func UploadFromFile(ctx *context.T, von, path string) (*security.Signature, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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