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
- Variables
- func Delete(ctx *context.T, name string) error
- func Download(ctx *context.T, von string) ([]byte, repository.MediaInfo, error)
- func DownloadToFile(ctx *context.T, von, path string) error
- func DownloadUrl(ctx *context.T, von string) (string, int64, error)
- func NewDispatcher(ctx *context.T, state *state) (rpc.Dispatcher, error)
- func NewHTTPRoot(ctx *context.T, state *state) http.FileSystem
- func NewState(rootDir, rootURL string, depth int) (*state, error)
- func SetupRootDir(root string) (string, error)
- func Sign(ctx *context.T, in io.Reader) (*security.Signature, error)
- func Stat(ctx *context.T, name string) (repository.MediaInfo, error)
- func Upload(ctx *context.T, von string, data []byte, mediaInfo repository.MediaInfo) (*security.Signature, error)
- func UploadFromDir(ctx *context.T, von, sourceDir string) (*security.Signature, error)
- func UploadFromFile(ctx *context.T, von, path string) (*security.Signature, error)
Constants ¶
const ( VersionFile = "VERSION" Version = "1.0" )
const BufferLength = 4096
Variables ¶
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{:_}") )
var MissingPart = binary.PartInfo{ Checksum: binary.MissingChecksum, Size: binary.MissingSize, }
TODO(jsimsa): When VDL supports composite literal constants, remove this definition.
Functions ¶
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 ¶
NewState creates a new state object for the binary service. This should be passed into both NewDispatcher and NewHTTPRoot.
func SetupRootDir ¶
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 UploadFromDir ¶
Types ¶
This section is empty.