Documentation
¶
Overview ¶
Package client is the public Go SDK for VaultFS. It connects to the master cluster, splits files into content-addressed chunks, writes them to chunk servers along a replication chain, and reads them back with integrity verification.
Typical use:
c, err := client.New(client.Config{MasterAddrs: []string{"localhost:9000"}})
if err != nil { ... }
defer c.Close()
err = c.Put(ctx, "./local.txt", "/remote/local.txt")
Index ¶
- Constants
- type Client
- func (c *Client) Close() error
- func (c *Client) Delete(ctx context.Context, path string) error
- func (c *Client) Get(ctx context.Context, remotePath, localPath string) error
- func (c *Client) ListDir(ctx context.Context, path string) ([]*vaultfsv1.FileInfo, error)
- func (c *Client) Put(ctx context.Context, localPath, remotePath string) error
- func (c *Client) Stat(ctx context.Context, path string) (*vaultfsv1.FileInfo, error)
- func (c *Client) Status(ctx context.Context) (*vaultfsv1.ClusterStatusResponse, error)
- type Config
Constants ¶
const DefaultChunkSize = 4 << 20
DefaultChunkSize is the size at which files are split into chunks (4 MiB).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a connection to a VaultFS cluster. It is safe for concurrent use.
func New ¶
New creates a Client from cfg. It returns an error if no master addresses are configured.
func (*Client) Get ¶
Get downloads remotePath and writes it to localPath, verifying every chunk's integrity against its content address.
func (*Client) Put ¶
Put uploads the file at localPath and stores it at remotePath. The file is split into chunks, each written to its planned chunk servers, and the file is finalised in the namespace once all chunks are durable.
type Config ¶
type Config struct {
// MasterAddrs is one or more master addresses. The client fails over across
// them in order when a master is unreachable.
MasterAddrs []string
// ChunkSize overrides the file split size. Zero uses DefaultChunkSize.
ChunkSize int
// DialOptions overrides the gRPC dial options. When nil, an insecure
// transport is used (mTLS is wired in Step 5).
DialOptions []grpc.DialOption
}
Config configures a Client.