satellite

package module
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 29 Imported by: 0

README

renterd-satellite

Satellite package for use within Sia renting software

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSatellite

func NewSatellite(ac autopilotClient, bc busClient, wc workerClient, dir string, seed types.PrivateKey, l *zap.Logger, satAddr string, satPassword string) (http.Handler, error)

NewSatellite returns a new Satellite handler.

func UploadObject added in v0.4.0

func UploadObject(r io.Reader, bucket, path, mimeType string) error

UploadObject uploads a file to the satellite.

func UploadPart added in v0.6.0

func UploadPart(r io.Reader, id string, part int) error

UploadPart uploads a part of an S3 multipart upload to the satellite.

Types

type BucketFiles added in v0.3.0

type BucketFiles struct {
	Name  string   `json:"name"`
	Paths []string `json:"paths"`
}

BucketFiles contains a list of filepaths within a single bucket.

type Client

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

A Client provides methods for interacting with an API server.

var StaticSatellite *Client

func NewClient

func NewClient(addr, password string) *Client

NewClient returns a client that communicates with a renterd satellite server listening on the specified address.

func (*Client) AbortMultipart added in v0.6.0

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

AbortMultipart deletes an incomplete multipart upload on the satellite.

func (*Client) AddObject added in v0.6.0

func (c *Client) AddObject(bucket, path string, parts []uint64) error

AddObject adds the information about an encrypted object.

func (*Client) AddSatellite

func (c *Client) AddSatellite(si SatelliteInfo) error

AddSatellite adds a satellite to the store.

func (*Client) CompleteMultipart added in v0.6.0

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

CompleteMultipart completes an incomplete multipart upload on the satellite.

func (*Client) Config

func (c *Client) Config() (cfg Config, err error)

Config returns the satellite's current configuration.

func (*Client) CreateMultipart added in v0.6.0

func (c *Client) CreateMultipart(ctx context.Context, key object.EncryptionKey, bucket, path, mimeType string) (string, error)

CreateMultipart registers a new multipart upload with the satellite and returns the upload ID.

func (*Client) DeleteObject added in v0.6.0

func (c *Client) DeleteObject(bucket, path string) error

DeleteObject deletes the information about an encrypted object.

func (*Client) DeleteObjects added in v0.6.0

func (c *Client) DeleteObjects(bucket, path string) error

DeleteObjects deletes the information about a series of encrypted objects.

func (*Client) FormContract added in v0.1.2

func (c *Client) FormContract(ctx context.Context, hpk types.PublicKey, endHeight uint64, storage uint64, upload uint64, download uint64) (api.ContractMetadata, error)

FormContract requests the satellite to form a contract with the specified host and adds it to the contract set.

func (*Client) FormContracts

func (c *Client) FormContracts(ctx context.Context, hosts uint64, period uint64, renewWindow uint64, storage uint64, upload uint64, download uint64) ([]api.ContractMetadata, error)

FormContracts requests the satellite to form the specified number of contracts with the hosts and adds them to the contract set.

func (*Client) GetObject added in v0.6.0

func (c *Client) GetObject(bucket, path string) (or ObjectResponse, err error)

GetObject retrieves the information about an encrypted object.

func (*Client) GetSatellite

func (c *Client) GetSatellite(pk types.PublicKey) (si SatelliteInfo, err error)

GetSatellite retrieves the satellite information.

func (*Client) GetSatellites

func (c *Client) GetSatellites() (satellites map[types.PublicKey]SatelliteInfo, err error)

GetSatellites returns all known satellites.

func (*Client) GetSettings added in v0.1.4

func (c *Client) GetSettings(ctx context.Context) (settings RenterSettings, err error)

GetSettings retrieves the renter's opt-in settings.

func (*Client) RenewContract added in v0.1.3

func (c *Client) RenewContract(ctx context.Context, fcid types.FileContractID, endHeight uint64, storage uint64, upload uint64, download uint64) (api.ContractMetadata, error)

RenewContract requests the satellite to renew the specified contract and adds the new contract to the contract set.

func (*Client) RenewContracts

func (c *Client) RenewContracts(ctx context.Context, contracts []types.FileContractID, period uint64, renewWindow uint64, storage uint64, upload uint64, download uint64) ([]api.ContractMetadata, error)

RenewContracts requests the satellite to renew the given set of contracts and add them to the contract set.

func (*Client) RequestContracts

func (c *Client) RequestContracts(ctx context.Context) ([]api.ContractMetadata, error)

RequestContracts requests the existing active contracts from the satellite and adds them to the contract set.

func (*Client) RequestMetadata added in v0.1.9

func (c *Client) RequestMetadata(ctx context.Context, set string) (objects []object.Object, err error)

RequestMetadata requests the file metadata from the satellite.

func (*Client) RequestSlabs added in v0.4.0

func (c *Client) RequestSlabs(ctx context.Context, set string) (slabs []object.Slab, err error)

RequestSlabs requests any modified slabs from the satellite.

func (*Client) SaveMetadata added in v0.1.9

func (c *Client) SaveMetadata(ctx context.Context, fm FileMetadata, isNew bool) error

SaveMetadata sends the file metadata to the satellite.

func (*Client) SetConfig

func (c *Client) SetConfig(cfg Config) error

SetConfig updates the satellite's configuration.

func (*Client) ShareContracts added in v0.1.11

func (c *Client) ShareContracts(ctx context.Context) error

ShareContracts sends the contract set to the satellite.

func (*Client) UpdateRevision

func (c *Client) UpdateRevision(ctx context.Context, rev rhpv2.ContractRevision, spending api.ContractSpending) error

UpdateRevision submits an updated contract revision to the satellite.

func (*Client) UpdateSettings added in v0.1.4

func (c *Client) UpdateSettings(ctx context.Context, settings RenterSettings) error

UpdateSettings updates the renter's opt-in settings.

func (*Client) UpdateSlab added in v0.1.10

func (c *Client) UpdateSlab(ctx context.Context, s object.Slab, packed bool) error

UpdateSlab sends the updated slab to the satellite.

type Config

type Config struct {
	Enabled       bool                 `json:"enabled"`
	Encrypt       bool                 `json:"encrypt"`
	EncryptionKey object.EncryptionKey `json:"encryptionKey"`
	SatelliteInfo
}

Config contains the satellite configuration parameters.

type CreateMultipartRequest added in v0.6.0

type CreateMultipartRequest struct {
	Key      object.EncryptionKey `json:"key"`
	Bucket   string               `json:"bucket"`
	Path     string               `json:"path"`
	MimeType string               `json:"mime"`
}

CreateMultipartRequest is the request type for the CreateMultipart RPC.

type CreateMultipartResponse added in v0.6.0

type CreateMultipartResponse struct {
	UploadID string `json:"uploadID"`
}

CreateMultipartResponse is the response type for the CreateMultipart RPC.

type FileMetadata added in v0.1.9

type FileMetadata struct {
	Key      object.EncryptionKey `json:"key"`
	Bucket   string               `json:"bucket"`
	Path     string               `json:"path"`
	ETag     string               `json:"etag"`
	MimeType string               `json:"mime"`
	Parts    []uint64             `json:"parts"`
	Slabs    []object.SlabSlice   `json:"slabs"`
	Data     []byte               `json:"data"`
}

FileMetadata contains the uploaded file metadata.

type FormContractRequest added in v0.1.2

type FormContractRequest struct {
	HostKey types.PublicKey `json:"hostPublicKey"`
	// Contract configuration (all units are blocks or bytes).
	EndHeight uint64 `json:"endHeight"`
	Download  uint64 `json:"download"`
	Upload    uint64 `json:"upload"`
	Storage   uint64 `json:"storage"`
}

FormContractRequest is the request type for the FormContract RPC.

type FormRequest

type FormRequest struct {
	Hosts uint64 `json:"hosts"`
	// Contract configuration (all units are blocks or bytes).
	Period      uint64 `json:"period"`
	RenewWindow uint64 `json:"renewWindow"`
	Download    uint64 `json:"download"`
	Upload      uint64 `json:"upload"`
	Storage     uint64 `json:"storage"`
}

FormRequest is the request type for the FormContracts RPC.

type ObjectPutRequest added in v0.6.0

type ObjectPutRequest struct {
	Bucket string   `json:"bucket"`
	Parts  []uint64 `json:"parts"`
}

ObjectPutRequest is the request type for the PUT /object requests.

type ObjectResponse added in v0.6.0

type ObjectResponse struct {
	Found bool     `json:"found"`
	Parts []uint64 `json:"parts"`
}

ObjectResponse is the response type for the GET /object request.

type RenewContractRequest added in v0.1.3

type RenewContractRequest struct {
	Contract types.FileContractID `json:"contract"`
	// Contract configuration (all units are blocks or bytes).
	EndHeight uint64 `json:"endHeight"`
	Download  uint64 `json:"download"`
	Upload    uint64 `json:"upload"`
	Storage   uint64 `json:"storage"`
}

RenewContractRequest is the request type for the RenewContract RPC.

type RenewRequest

type RenewRequest struct {
	Contracts []types.FileContractID `json:"contracts"`
	// Contract configuration (all units are blocks or bytes).
	Period      uint64 `json:"period"`
	RenewWindow uint64 `json:"renewWindow"`
	Download    uint64 `json:"download"`
	Upload      uint64 `json:"upload"`
	Storage     uint64 `json:"storage"`
}

RenewRequest is the request type for the RenewContracts RPC.

type RenterSettings added in v0.1.4

type RenterSettings struct {
	AutoRenewContracts bool `json:"autoRenew"`
	BackupFileMetadata bool `json:"backupMetadata"`
	AutoRepairFiles    bool `json:"autoRepair"`
	ProxyUploads       bool `json:"proxyUploads"`
}

RenterSettings contains the renter's opt-in settings.

func (*RenterSettings) DecodeFrom added in v0.1.4

func (settings *RenterSettings) DecodeFrom(d *types.Decoder)

DecodeFrom implements types.ProtocolObject.

func (*RenterSettings) EncodeTo added in v0.1.4

func (settings *RenterSettings) EncodeTo(e *types.Encoder)

EncodeTo implements types.ProtocolObject.

type Satellite

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

Satellite is the interface between the renting software and the Sia Satellite node.

func New

func New(ac autopilotClient, bc busClient, wc workerClient, ss jsonStore, seed types.PrivateKey, l *zap.Logger) (*Satellite, error)

New returns a new Satellite.

func (*Satellite) Handler

func (s *Satellite) Handler() http.Handler

Handler returns an HTTP handler that serves the satellite API.

type SatelliteInfo

type SatelliteInfo struct {
	Address    string          `json:"address"`
	MuxPort    string          `json:"muxPort"`
	PublicKey  types.PublicKey `json:"publicKey"`
	RenterSeed []byte          `json:"renterSeed"`
}

SatelliteInfo contains the information about the satellite.

type SatellitesAllResponse

type SatellitesAllResponse struct {
	Satellites map[types.PublicKey]SatelliteInfo `json:"satellites"`
}

SatellitesAllResponse is the response type for the /satellites request.

type SaveMetadataRequest added in v0.1.9

type SaveMetadataRequest struct {
	Metadata FileMetadata `json:"metadata"`
	New      bool         `json:"new"`
}

SaveMetadataRequest is the request type for the SaveMetadata RPC.

type UpdateRevisionRequest

type UpdateRevisionRequest struct {
	Revision rhpv2.ContractRevision `json:"revision"`
	Spending api.ContractSpending   `json:"spending"`
}

UpdateRevisionRequest is the request type for the UpdateRevision RPC.

type UpdateSlabRequest added in v0.1.10

type UpdateSlabRequest struct {
	Slab   object.Slab `json:"slab"`
	Packed bool        `json:"packed"`
}

UpdateSlabRequest is the request type for the UpdateSlab RPC.

Directories

Path Synopsis
Package chacha20 implements the ChaCha20 and XChaCha20 encryption algorithms as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
Package chacha20 implements the ChaCha20 and XChaCha20 encryption algorithms as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.

Jump to

Keyboard shortcuts

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