client

package
v0.1.0-preview.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckReplicationProfile

func CheckReplicationProfile(p rp.Profile, pin, root string) error

Types

type ByteObservation

type ByteObservation struct {
	State             string     `json:"state"`
	Basis             string     `json:"basis"`
	AcknowledgedBytes int64      `json:"acknowledged_bytes"`
	TotalBytes        *int64     `json:"total_bytes"`
	Revision          int64      `json:"revision"`
	SampledAt         *time.Time `json:"sampled_at"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(baseURL string, identity *secure.Identity, ownerID, deviceID string) (*Client, error)

func NewWithClock

func NewWithClock(baseURL string, identity *secure.Identity, ownerID, deviceID string, offset time.Duration) (*Client, error)

func (*Client) AddP2PSignal

func (c *Client) AddP2PSignal(ctx context.Context, transferID, ownerID, deviceID, role, channel, payload string) error

func (*Client) BindReplication

func (c *Client) BindReplication(ctx context.Context, b rp.Binding) (rp.Profile, error)

func (*Client) Broadcast

func (c *Client) Broadcast(ctx context.Context, entryID, senderOwner, senderDevice, recipientOwner string) (TransferList, error)

func (*Client) CommitReuse

func (c *Client) CommitReuse(ctx context.Context, token string) (CompleteResponse, error)

func (*Client) CompleteP2P

func (c *Client) CompleteP2P(ctx context.Context, transferID, ownerID, deviceID string, version int64) (Transfer, error)

func (*Client) CompletePull

func (c *Client) CompletePull(ctx context.Context, pullID, deviceID, contentRoot string) (PullCompleteResponse, error)

func (*Client) CompleteUpload

func (c *Client) CompleteUpload(ctx context.Context, uploadID string) (CompleteResponse, error)

func (*Client) Content

func (c *Client) Content(ctx context.Context, pullID string, offset int64) (*http.Response, error)

func (*Client) ContentRange

func (c *Client) ContentRange(ctx context.Context, pullID string, start, end int64) (*http.Response, error)

func (*Client) CreateP2P

func (c *Client) CreateP2P(ctx context.Context, request P2PCreateRequest) (Transfer, error)

func (*Client) CreatePull

func (c *Client) CreatePull(ctx context.Context, entryID, ownerID, deviceID, transferID string) (Pull, error)

func (*Client) CreateTransfer

func (c *Client) CreateTransfer(ctx context.Context, request TransferCreateRequest) (Transfer, error)

func (*Client) DeviceAction

func (c *Client) DeviceAction(ctx context.Context, action, ownerID, deviceID, publicKey, signingPublicKey string) (Device, error)

func (*Client) DialRelay

func (c *Client) DialRelay(ctx context.Context, id, role string) (*websocket.Conn, error)

func (*Client) FileAction

func (c *Client) FileAction(ctx context.Context, entryID, action, ownerID, deviceID string, version int64, transfer ...string) (FileSnapshot, error)

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, entryID, ownerID string, access ...string) (FileSnapshot, error)

func (*Client) GetManifest

func (c *Client) GetManifest(ctx context.Context, entryID, ownerID, deviceID, transferID string) (ManifestEnvelope, error)

func (*Client) GetP2PProgress

func (c *Client) GetP2PProgress(ctx context.Context, id, ownerID, deviceID string) (P2PProgressSnapshot, error)

func (*Client) GetPull

func (c *Client) GetPull(ctx context.Context, pullID, ownerID, deviceID string) (Pull, error)

func (*Client) GetQuota

func (c *Client) GetQuota(ctx context.Context, scopeID string) (Quota, error)

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, id, ownerID, deviceID string) (Task, error)

func (*Client) GetTransfer

func (c *Client) GetTransfer(ctx context.Context, id, ownerID, deviceID string) (Transfer, error)

func (*Client) ListDevices

func (c *Client) ListDevices(ctx context.Context, ownerID string) (DeviceList, error)

func (*Client) ListTasks

func (c *Client) ListTasks(ctx context.Context, ownerID, deviceID, kind, state string, includeDeleted bool, limit int) (TaskList, error)

func (*Client) ListTransfers

func (c *Client) ListTransfers(ctx context.Context, path, ownerID, deviceID, role, state string, limit int) (TransferList, error)

func (*Client) ObserveP2PProgress

func (c *Client) ObserveP2PProgress(ctx context.Context, transferID, ownerID, deviceID string, received int64, route string, epoch int64) error

func (*Client) P2PProgress

func (c *Client) P2PProgress(ctx context.Context, transferID, ownerID, deviceID string, received int64) error

func (*Client) P2PSignals

func (c *Client) P2PSignals(ctx context.Context, transferID, ownerID, deviceID string, after int64) (P2PSignalList, error)

func (*Client) Prepare

func (c *Client) Prepare(ctx context.Context, request PrepareRequest) (PrepareResponse, error)

func (*Client) PutManifestEnvelope

func (c *Client) PutManifestEnvelope(ctx context.Context, entryID, ownerID, deviceID, targetOwnerID, targetDeviceID string, ciphertext []byte) error

func (*Client) ReadReplication

func (c *Client) ReadReplication(ctx context.Context, epoch string, after int64, snapshot bool, upper int64, key string) (rp.Page, error)

func (*Client) RecipientPublicKey

func (c *Client) RecipientPublicKey(ctx context.Context, ownerID, deviceID string) (string, error)

func (*Client) RelayTransport

func (c *Client) RelayTransport(ctx context.Context, id string) (string, error)

func (*Client) ReplicationProfile

func (c *Client) ReplicationProfile(ctx context.Context, stream string) (rp.Profile, error)

func (*Client) ReplicationRoster

func (c *Client) ReplicationRoster(ctx context.Context, r rp.Roster) (rp.Profile, error)

func (*Client) SubmitP2PSignal

func (c *Client) SubmitP2PSignal(ctx context.Context, transferID, ownerID, deviceID, role, channel, payload string, replyTo int64) (P2PSignal, error)

func (*Client) Sync

func (c *Client) Sync(ctx context.Context, after int64, limit int, ownerID, deviceID string) (SyncResponse, error)

func (*Client) TaskAction

func (c *Client) TaskAction(ctx context.Context, id, action, ownerID, deviceID string, version int64, reason ...string) (Task, error)

func (*Client) TaskProgress

func (c *Client) TaskProgress(ctx context.Context, id, ownerID, deviceID string, progress int64) (Task, error)

func (*Client) TaskProjection

func (c *Client) TaskProjection(ctx context.Context, id, ownerID, deviceID string) (TaskProjection, error)

func (*Client) TransferAction

func (c *Client) TransferAction(ctx context.Context, id, action, ownerID, deviceID string, version int64, reason string) (Transfer, error)

func (*Client) UploadChunk

func (c *Client) UploadChunk(ctx context.Context, uploadID string, index int, digest string, data []byte) error

func (*Client) UploadReplication

func (c *Client) UploadReplication(ctx context.Context, b rp.Upload) (rp.Ack, error)

type CompleteResponse

type CompleteResponse struct {
	File   FileEntry `json:"file"`
	Reused bool      `json:"reused"`
}

type Device

type Device struct {
	OwnerID   string  `json:"owner_id"`
	DeviceID  string  `json:"device_id"`
	PublicKey *string `json:"public_key,omitempty"`
	Status    string  `json:"status"`
}

type DeviceList

type DeviceList struct {
	Devices []Device `json:"devices"`
}

type FileEntry

type FileEntry struct {
	ID             string     `json:"id"`
	VersionID      string     `json:"version_id"`
	OwnerID        string     `json:"owner_id"`
	DeviceID       string     `json:"device_id"`
	FileName       string     `json:"file_name"`
	RetentionClass string     `json:"retention_class"`
	State          string     `json:"state"`
	ExpiresAt      *time.Time `json:"expires_at,omitempty"`
}

type FileSnapshot

type FileSnapshot struct {
	ReferenceKind  string     `json:"reference_kind"`
	ID             string     `json:"id"`
	VersionID      string     `json:"version_id"`
	OwnerID        string     `json:"owner_id"`
	DeviceID       string     `json:"device_id"`
	FileName       string     `json:"file_name"`
	RetentionClass string     `json:"retention_class"`
	State          string     `json:"state"`
	ExpiresAt      *time.Time `json:"expires_at,omitempty"`
	Version        int64      `json:"version"`
}

type Manifest

type Manifest struct {
	VersionID         string `json:"version_id"`
	ContentRoot       string `json:"content_root"`
	SizeBytes         int64  `json:"size_bytes"`
	ChunkSize         int    `json:"chunk_size"`
	ChunkCount        int    `json:"chunk_count"`
	EncryptionSuite   string `json:"encryption_suite,omitempty"`
	EncryptedManifest []byte `json:"encrypted_manifest,omitempty"`
}

type ManifestEnvelope

type ManifestEnvelope struct {
	OwnerID           string `json:"owner_id"`
	DeviceID          string `json:"device_id"`
	EncryptionSuite   string `json:"encryption_suite"`
	EncryptedManifest []byte `json:"encrypted_manifest"`
}

type P2PCreateRequest

type P2PCreateRequest struct {
	SenderOwnerID           string `json:"sender_owner_id"`
	SenderDeviceID          string `json:"sender_device_id"`
	RecipientOwnerID        string `json:"recipient_owner_id"`
	RecipientDeviceID       string `json:"recipient_device_id"`
	FileName                string `json:"file_name"`
	SizeBytes               int64  `json:"size_bytes"`
	ContentRoot             string `json:"content_root"`
	EncryptionSuite         string `json:"encryption_suite"`
	EncryptedManifest       []byte `json:"encrypted_manifest"`
	SenderEncryptedManifest []byte `json:"sender_encrypted_manifest"`
}

type P2PProgressSnapshot

type P2PProgressSnapshot struct {
	TransferID       string    `json:"transfer_id"`
	AttemptID        string    `json:"attempt_id"`
	State            string    `json:"state"`
	StateVersion     int64     `json:"state_version"`
	ProgressRevision int64     `json:"progress_revision"`
	Direction        string    `json:"direction"`
	DisplayMetricID  string    `json:"display_metric_id"`
	ExpiresAt        time.Time `json:"expires_at"`
	Route            struct {
		Kind  string `json:"kind"`
		Epoch int64  `json:"epoch"`
	} `json:"route"`
	Delivery ByteObservation `json:"delivery"`
	Spool    struct {
		ByteObservation
		StateVersion int64      `json:"state_version"`
		SealedAt     *time.Time `json:"sealed_at"`
	} `json:"spool"`
	Completion struct {
		Delivered bool `json:"delivered"`
		Stored    bool `json:"stored"`
	} `json:"completion"`
	Capabilities map[string]bool `json:"capabilities"`
}

type P2PSignal

type P2PSignal struct {
	ReplyTo    int64     `json:"reply_to,omitempty"`
	Sequence   int64     `json:"sequence"`
	Channel    string    `json:"channel"`
	Payload    string    `json:"payload"`
	SenderRole string    `json:"sender_role"`
	CreatedAt  time.Time `json:"created_at"`
}

type P2PSignalList

type P2PSignalList struct {
	Signals []P2PSignal `json:"signals"`
}

type PrepareRequest

type PrepareRequest struct {
	ScopeID            string `json:"scope_id"`
	EncryptionDomainID string `json:"encryption_domain_id"`
	OwnerID            string `json:"owner_id"`
	DeviceID           string `json:"device_id"`
	FileName           string `json:"file_name"`
	RetentionClass     string `json:"retention_class"`
	HashVersion        string `json:"hash_version"`
	DedupKey           string `json:"dedup_key"`
	ContentRoot        string `json:"content_root"`
	SizeBytes          int64  `json:"size_bytes"`
	ChunkSize          int    `json:"chunk_size"`
	EncryptionSuite    string `json:"encryption_suite,omitempty"`
	EncryptedManifest  []byte `json:"encrypted_manifest,omitempty"`
}

type PrepareResponse

type PrepareResponse struct {
	Status         string   `json:"status"`
	UploadID       string   `json:"upload_id"`
	TaskID         string   `json:"task_id"`
	ReuseToken     string   `json:"reuse_token"`
	ReceivedChunks []int    `json:"received_chunks"`
	Manifest       Manifest `json:"manifest"`
}

type Pull

type Pull struct {
	ID          string `json:"id"`
	TaskID      string `json:"task_id"`
	TransferID  string `json:"transfer_id,omitempty"`
	EntryID     string `json:"entry_id"`
	DeviceID    string `json:"device_id"`
	FileName    string `json:"file_name"`
	ContentRoot string `json:"content_root"`
	SizeBytes   int64  `json:"size_bytes"`
}

type PullCompleteResponse

type PullCompleteResponse struct {
	FirstDelivery bool `json:"first_delivery"`
}

type Quota

type Quota struct {
	ScopeID    string `json:"scope_id"`
	QuotaBytes int64  `json:"quota_bytes"`
	UsedBytes  int64  `json:"used_bytes"`
	Version    int64  `json:"version"`
}

type SyncEvent

type SyncEvent struct {
	Sequence         int64           `json:"sequence"`
	EventID          string          `json:"event_id"`
	EventType        string          `json:"event_type"`
	AggregateID      string          `json:"aggregate_id"`
	AggregateVersion int64           `json:"aggregate_version"`
	Payload          json.RawMessage `json:"payload"`
	OccurredAt       time.Time       `json:"occurred_at"`
}

type SyncResponse

type SyncResponse struct {
	Events          []SyncEvent `json:"events"`
	CurrentSequence int64       `json:"current_sequence"`
}

type Task

type Task struct {
	ID            string    `json:"id"`
	Kind          string    `json:"kind"`
	ReferenceID   string    `json:"reference_id"`
	OwnerID       string    `json:"owner_id"`
	DeviceID      string    `json:"device_id"`
	State         string    `json:"state"`
	ProgressBytes int64     `json:"progress_bytes"`
	TotalBytes    int64     `json:"total_bytes"`
	Version       int64     `json:"version"`
	ErrorCode     *string   `json:"error_code,omitempty"`
	ErrorMessage  *string   `json:"error_message,omitempty"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

type TaskList

type TaskList struct {
	Tasks      []Task     `json:"tasks"`
	NextBefore *time.Time `json:"next_before,omitempty"`
}

type TaskProjection

type TaskProjection struct {
	State         string  `json:"state"`
	ProgressBytes int64   `json:"progress_bytes"`
	TotalBytes    int64   `json:"total_bytes"`
	Version       int64   `json:"version"`
	ErrorCode     *string `json:"error_code,omitempty"`
}

type Transfer

type Transfer struct {
	ID                      string    `json:"id"`
	EntryID                 *string   `json:"entry_id,omitempty"`
	DeliveryMode            string    `json:"delivery_mode"`
	SenderOwnerID           string    `json:"sender_owner_id"`
	SenderDeviceID          string    `json:"sender_device_id"`
	RecipientOwnerID        string    `json:"recipient_owner_id"`
	RecipientDeviceID       string    `json:"recipient_device_id"`
	State                   string    `json:"state"`
	Version                 int64     `json:"version"`
	FailureReason           *string   `json:"failure_reason,omitempty"`
	CreatedAt               time.Time `json:"created_at"`
	UpdatedAt               time.Time `json:"updated_at"`
	ExpiresAt               time.Time `json:"expires_at"`
	FileName                *string   `json:"file_name,omitempty"`
	SizeBytes               *int64    `json:"size_bytes,omitempty"`
	ContentRoot             *string   `json:"content_root,omitempty"`
	EncryptionSuite         *string   `json:"encryption_suite,omitempty"`
	EncryptedManifest       []byte    `json:"encrypted_manifest,omitempty"`
	SenderEncryptedManifest []byte    `json:"sender_encrypted_manifest,omitempty"`
	ReceivedBytes           int64     `json:"received_bytes"`
}

type TransferCreateRequest

type TransferCreateRequest struct {
	EntryID           string `json:"entry_id"`
	DeliveryMode      string `json:"delivery_mode"`
	SenderOwnerID     string `json:"sender_owner_id"`
	SenderDeviceID    string `json:"sender_device_id"`
	RecipientOwnerID  string `json:"recipient_owner_id"`
	RecipientDeviceID string `json:"recipient_device_id"`
}

type TransferList

type TransferList struct {
	Transfers  []Transfer `json:"transfers"`
	NextBefore *time.Time `json:"next_before,omitempty"`
}

Jump to

Keyboard shortcuts

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