cmdblob

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cmdblob provides basic support for reading and writing implementations of the blob.Store interface.

Index

Constants

This section is empty.

Variables

View Source
var Command = &command.C{
	Name: "blob",
	Help: `Manipulate the contents of a blob store.

Since blob keys are usually binary, key arguments are assumed to be encoded.

Rule                                                     Example
- To specify blob keys literally, prefix them with "@"   @foo
  To escape a leading @, double it                       @@foo
- If the key is all hex digits, decode it as hex         666f6f0a
- Otherwise, it is treated as base64.                    Zm9vCg==

If the FFS_STORE environment variable is set, it is read to set the
address of the storage server. Otherwise, --store must be set to either
the address or an @tag from the configuration file.
`,

	SetFlags: func(env *command.Env, fs *flag.FlagSet) { bf.Flag("bucket").Bind(fs) },

	Commands: []*command.C{
		{
			Name:  "get",
			Usage: "get <key>...",
			Help:  "Read blobs from the store.",
			Run:   getCmd,
		},
		{
			Name:  "put",
			Usage: "put <key> [<path>]",
			Help:  "Write a blob to the store.",

			SetFlags: func(env *command.Env, fs *flag.FlagSet) { bf.Flag("replace").Bind(fs) },
			Run:      command.Adapt(putCmd),
		},
		{
			Name:  "size",
			Usage: "<key>...",
			Help:  "Print the sizes of stored blobs.",
			Run:   sizeCmd,
		},
		{
			Name:  "delete",
			Usage: "<key> ...",
			Help:  "Delete blobs from the store.",

			SetFlags: func(env *command.Env, fs *flag.FlagSet) { bf.Flag("missing-ok").Bind(fs) },
			Run:      delCmd,
		},
		{
			Name: "list",
			Help: "List keys in the store.",

			SetFlags: command.Flags(flax.MustBind, &listFlags),
			Run:      command.Adapt(listCmd),
		},
		{
			Name: "len",
			Help: "Print the number of stored keys.",
			Run:  command.Adapt(lenCmd),
		},
		{
			Name: "cas-key",
			Help: "Compute the key for a blob without writing it.",
			Run:  command.Adapt(casKeyCmd),
		},
		{
			Name:  "cas-put",
			Usage: "cas-put",
			Help:  "Write a content-addressed blob to the store from stdin.",
			Run:   command.Adapt(casPutCmd),
		},
		{
			Name:     "copy",
			Usage:    "<src> <dst>",
			Help:     "Copy the contents of one blob to another key.",
			SetFlags: func(env *command.Env, fs *flag.FlagSet) { bf.Flag("replace").Bind(fs) },
			Run:      command.Adapt(copyCmd),
		},
		{
			Name:  "sync-keys",
			Usage: "<key>...",
			Help:  "Report which of the specified keys are not in the store.",
			Run:   command.Adapt(syncKeysCmd),
		},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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