client

package
v0.0.0-...-f4026f9 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 14 Imported by: 0

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

View Source
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

func New(cfg Config) (*Client, error)

New creates a Client from cfg. It returns an error if no master addresses are configured.

func (*Client) Close

func (c *Client) Close() error

Close releases all connections held by the client.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) error

Delete removes the file at path from the namespace.

func (*Client) Get

func (c *Client) Get(ctx context.Context, remotePath, localPath string) error

Get downloads remotePath and writes it to localPath, verifying every chunk's integrity against its content address.

func (*Client) ListDir

func (c *Client) ListDir(ctx context.Context, path string) ([]*vaultfsv1.FileInfo, error)

ListDir returns the direct children of the directory at path.

func (*Client) Put

func (c *Client) Put(ctx context.Context, localPath, remotePath string) error

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.

func (*Client) Stat

func (c *Client) Stat(ctx context.Context, path string) (*vaultfsv1.FileInfo, error)

Stat returns the metadata for path.

func (*Client) Status

Status returns a snapshot of cluster health from the admin service.

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.

Jump to

Keyboard shortcuts

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