Documentation
¶
Index ¶
- Variables
- func AddRecoveryKey(ctx context.Context, rawStore store.ObjectStore, kc keychain.Chain) (string, error)
- func ChangePassword(ctx context.Context, rawStore store.ObjectStore, kc keychain.Chain, ...) error
- type BackupOption
- type BackupResult
- type CatResult
- type CheckError
- type CheckOption
- type CheckResult
- type Client
- func (c *Client) Backup(ctx context.Context, src source.Source, opts ...BackupOption) (*BackupResult, error)
- func (c *Client) BreakLock(ctx context.Context) ([]*RepoLock, error)
- func (c *Client) Cat(ctx context.Context, keys ...string) ([]*CatResult, error)
- func (c *Client) Check(ctx context.Context, opts ...CheckOption) (*CheckResult, error)
- func (c *Client) Diff(ctx context.Context, snap1, snap2 string, opts ...DiffOption) (*DiffResult, error)
- func (c *Client) Forget(ctx context.Context, snapshotID string, opts ...ForgetOption) (*ForgetResult, error)
- func (c *Client) ForgetPolicy(ctx context.Context, opts ...ForgetOption) (*PolicyResult, error)
- func (c *Client) List(ctx context.Context, opts ...ListOption) (*ListResult, error)
- func (c *Client) LsSnapshot(ctx context.Context, snapshotID string, opts ...LsSnapshotOption) (*LsSnapshotResult, error)
- func (c *Client) Prune(ctx context.Context, opts ...PruneOption) (*PruneResult, error)
- func (c *Client) Restore(ctx context.Context, w io.Writer, snapshotRef string, opts ...RestoreOption) (*RestoreResult, error)
- func (c *Client) Store() store.ObjectStore
- type ClientOption
- type DiffOption
- type DiffResult
- type ForgetOption
- type ForgetResult
- type InitOption
- type InitResult
- type KMSClient
- type KeySlot
- type ListOption
- type ListResult
- type LsSnapshotOption
- type LsSnapshotResult
- type PasswordProvider
- type PasswordProviderFunc
- type PasswordString
- type Phase
- type PolicyResult
- type PruneOption
- type PruneResult
- type RepoConfig
- type RepoLock
- type Reporter
- type RestoreOption
- type RestoreResult
Constants ¶
This section is empty.
Variables ¶
var ( WithInitCredentials = engine.WithInitCredentials WithInitRecovery = engine.WithInitRecovery WithInitNoEncryption = engine.WithInitNoEncryption WithInitAdoptSlots = engine.WithInitAdoptSlots )
var ( WithVerbose = engine.WithVerbose WithBackupDryRun = engine.WithBackupDryRun WithTags = engine.WithTags WithGenerator = engine.WithGenerator WithMeta = engine.WithMeta WithExcludeHash = engine.WithExcludeHash )
var ( WithRestoreDryRun = engine.WithRestoreDryRun WithRestoreVerbose = engine.WithRestoreVerbose WithRestorePath = engine.WithRestorePath )
var ( WithPruneDryRun = engine.WithPruneDryRun WithPruneVerbose = engine.WithPruneVerbose )
var ( WithPrune = engine.WithPrune WithDryRun = engine.WithDryRun WithForgetVerbose = engine.WithForgetVerbose WithKeepLast = engine.WithKeepLast WithKeepHourly = engine.WithKeepHourly WithKeepDaily = engine.WithKeepDaily WithKeepWeekly = engine.WithKeepWeekly WithKeepMonthly = engine.WithKeepMonthly WithKeepYearly = engine.WithKeepYearly WithGroupBy = engine.WithGroupBy WithFilterTag = engine.WithFilterTag WithFilterSource = engine.WithFilterSource WithFilterAccount = engine.WithFilterAccount WithFilterPath = engine.WithFilterPath )
var ( WithReadData = engine.WithReadData WithCheckVerbose = engine.WithCheckVerbose WithSnapshotRef = engine.WithSnapshotRef )
var WithDiffVerbose = engine.WithDiffVerbose
var WithListVerbose = engine.WithListVerbose
var WithLsVerbose = engine.WithLsVerbose
Functions ¶
func AddRecoveryKey ¶ added in v1.7.0
func AddRecoveryKey(ctx context.Context, rawStore store.ObjectStore, kc keychain.Chain) (string, error)
AddRecoveryKey generates a BIP39 recovery key for the repository, authenticating with kc to obtain the master key. Returns the 24-word mnemonic phrase.
func ChangePassword ¶ added in v1.7.0
func ChangePassword(ctx context.Context, rawStore store.ObjectStore, kc keychain.Chain, pwd PasswordProvider) error
ChangePassword replaces the password key slot using the provided keychain to authenticate and newPassword as the new passphrase.
Types ¶
type BackupOption ¶
type BackupOption = engine.BackupOption
type BackupResult ¶ added in v1.2.0
type CatResult ¶ added in v1.4.6
type CatResult struct {
Key string // The object key requested
Data []byte // Raw object data (typically JSON)
}
CatResult contains the raw data for an object key.
type CheckError ¶ added in v1.4.7
type CheckError = engine.CheckError
type CheckOption ¶ added in v1.4.7
type CheckOption = engine.CheckOption
type CheckResult ¶ added in v1.4.7
type CheckResult = engine.CheckResult
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the high-level interface for using Cloudstic as a library.
func NewClient ¶
func NewClient(base store.ObjectStore, opts ...ClientOption) (*Client, error)
func (*Client) Backup ¶
func (c *Client) Backup(ctx context.Context, src source.Source, opts ...BackupOption) (*BackupResult, error)
func (*Client) Cat ¶ added in v1.4.6
Cat fetches the raw data for one or more object keys from the repository. Object keys can be snapshot/<hash>, filemeta/<hash>, content/<hash>, node/<hash>, chunk/<hash>, config, index/latest, keys/<slot>, etc.
This is useful for debugging, inspection, and understanding the internal structure of the repository.
func (*Client) Check ¶ added in v1.4.7
func (c *Client) Check(ctx context.Context, opts ...CheckOption) (*CheckResult, error)
Check verifies the integrity of the repository by walking the full reference chain (snapshots → HAMT nodes → filemeta → content → chunks) and checking that every referenced object can be read. With WithReadData(), chunk data is re-hashed for byte-level verification.
func (*Client) Diff ¶
func (c *Client) Diff(ctx context.Context, snap1, snap2 string, opts ...DiffOption) (*DiffResult, error)
func (*Client) Forget ¶
func (c *Client) Forget(ctx context.Context, snapshotID string, opts ...ForgetOption) (*ForgetResult, error)
func (*Client) ForgetPolicy ¶
func (c *Client) ForgetPolicy(ctx context.Context, opts ...ForgetOption) (*PolicyResult, error)
func (*Client) List ¶
func (c *Client) List(ctx context.Context, opts ...ListOption) (*ListResult, error)
func (*Client) LsSnapshot ¶
func (c *Client) LsSnapshot(ctx context.Context, snapshotID string, opts ...LsSnapshotOption) (*LsSnapshotResult, error)
func (*Client) Prune ¶
func (c *Client) Prune(ctx context.Context, opts ...PruneOption) (*PruneResult, error)
func (*Client) Restore ¶
func (c *Client) Restore(ctx context.Context, w io.Writer, snapshotRef string, opts ...RestoreOption) (*RestoreResult, error)
Restore writes the snapshot's file tree as a ZIP archive to w. snapshotRef can be "", "latest", a bare hash, or "snapshot/<hash>".
func (*Client) Store ¶ added in v1.1.0
func (c *Client) Store() store.ObjectStore
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures a Client.
func WithEncryptionKey ¶ added in v1.1.0
func WithEncryptionKey(key []byte) ClientOption
WithEncryptionKey directly sets the AES-256-GCM encryption key (32 bytes). This bypasses repo config detection and unconditionally applies encryption. The HMAC deduplication key is automatically derived from this key. Use this for the SaaS product where the key is already resolved externally.
func WithKeychain ¶ added in v1.9.0
func WithKeychain(kc keychain.Chain) ClientOption
WithKeychain sets a Keychain for automatic master key resolution. During NewClient, the repo config is read from the store; if the repository is encrypted, Resolve is called to obtain the master key and the encryption key is derived. If the repository is not encrypted, the keychain is silently ignored.
func WithPackfile ¶ added in v1.4.3
func WithPackfile(enable bool) ClientOption
WithPackfile enables bundling small objects into 8MB packs to save API calls.
func WithReporter ¶
func WithReporter(r Reporter) ClientOption
WithReporter sets the progress reporter for the client.
type DiffOption ¶
type DiffOption = engine.DiffOption
type DiffResult ¶
type DiffResult = engine.DiffResult
type ForgetOption ¶
type ForgetOption = engine.ForgetOption
type ForgetResult ¶ added in v1.2.0
type ForgetResult = engine.ForgetResult
type InitOption ¶ added in v1.7.0
type InitOption = engine.InitOption
type InitResult ¶ added in v1.7.0
type InitResult = engine.InitResult
func InitRepo ¶ added in v1.7.0
func InitRepo(ctx context.Context, rawStore store.ObjectStore, opts ...InitOption) (*InitResult, error)
InitRepo bootstraps a new repository on the given raw (undecorated) store. This is a package-level function because init runs before the full Client decorator chain (encryption, compression, packfiles) is set up.
type KeySlot ¶ added in v1.4.6
KeySlot is re-exported for callers that need to inspect slot metadata.
func ListKeySlots ¶ added in v1.7.0
ListKeySlots returns all encryption key slots in the repository. Returns an error if the repository is not initialized or not encrypted.
type ListOption ¶
type ListOption = engine.ListOption
type ListResult ¶
type ListResult = engine.ListResult
type LsSnapshotOption ¶
type LsSnapshotOption = engine.LsSnapshotOption
type LsSnapshotResult ¶
type LsSnapshotResult = engine.LsSnapshotResult
type PasswordProvider ¶ added in v1.7.0
PasswordProvider supplies a new password when prompted. It is used by ChangePassword to obtain the replacement passphrase. Implementations may prompt the user interactively, derive a password programmatically, or return a static value.
type PasswordProviderFunc ¶ added in v1.7.0
PasswordProviderFunc is a function adapter for PasswordProvider. Any func(context.Context) (string, error) can be used as a PasswordProvider:
client.ChangePassword(ctx, store, creds, cloudstic.PasswordProviderFunc(func(ctx context.Context) (string, error) {
return promptUser("New password: ")
}))
func (PasswordProviderFunc) NewPassword ¶ added in v1.7.0
func (f PasswordProviderFunc) NewPassword(ctx context.Context) (string, error)
type PasswordString ¶ added in v1.7.0
type PasswordString string
PasswordString is a PasswordProvider that returns a fixed string. Use this when the new password is already known at call time:
client.ChangePassword(ctx, store, creds, cloudstic.PasswordString("my-new-password"))
func (PasswordString) NewPassword ¶ added in v1.7.0
func (p PasswordString) NewPassword(ctx context.Context) (string, error)
type PolicyResult ¶
type PolicyResult = engine.PolicyResult
type PruneOption ¶
type PruneOption = engine.PruneOption
type PruneResult ¶ added in v1.2.0
type PruneResult = engine.PruneResult
type RepoConfig ¶ added in v1.2.0
type RepoConfig = core.RepoConfig
RepoConfig is the repository marker written by "init".
func LoadRepoConfig ¶ added in v1.7.0
func LoadRepoConfig(ctx context.Context, rawStore store.ObjectStore) (*RepoConfig, error)
LoadRepoConfig reads the repository marker from a raw (undecorated) store. Returns (nil, nil) if the repository has not been initialized yet. Returns an error if the store is unreachable (e.g. invalid credentials).
type RestoreOption ¶
type RestoreOption = engine.RestoreOption
type RestoreResult ¶
type RestoreResult = engine.RestoreResult