Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) CreateCluster(ctx context.Context, name, region string) (*Cluster, error)
- func (c *Client) DeleteCluster(ctx context.Context, name string) error
- func (c *Client) ExportDatabase(ctx context.Context, database string) (io.ReadCloser, error)
- func (c *Client) HWM(ctx context.Context) (map[string]ltx.TXID, error)
- func (c *Client) ImportDatabase(ctx context.Context, database string, r io.Reader) (ltx.TXID, error)
- func (c *Client) ListClusters(ctx context.Context, input *ListClustersInput) (*ListClustersOutput, error)
- func (c *Client) Pos(ctx context.Context) (map[string]ltx.Pos, error)
- func (c *Client) Regions(ctx context.Context) ([]string, error)
- func (c *Client) RestoreDatabaseToTimestamp(ctx context.Context, database string, timestamp time.Time) (ltx.TXID, error)
- type Cluster
- type Error
- type ListClustersInput
- type ListClustersOutput
Constants ¶
const DefaultURL = "https://litefs.fly.io"
DefaultURL is the default URL set by NewClient().
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Base URL of the remote LiteFS Cloud service. URL string // Authentication token. Required for most API calls. Token string }
Client represents a client for connecting to LiteFS Cloud.
func NewClient ¶
func NewClient() *Client
NewClient returns a new instance of Client with the default URL.
func (*Client) CreateCluster ¶
CreateCluster creates a new cluster in a given region. An org-scoped authentication token with write permissions is required.
func (*Client) DeleteCluster ¶
DeleteCluster permanently deletes an existing cluster. An org-scoped authentication token with write permissions is required.
func (*Client) ExportDatabase ¶
ExportDatabase returns a reader that contains the current database state. A cluster-scoped authentication token with read permissions is required.
func (*Client) HWM ¶
HWM returns a map of database names with their current high-water mark. A cluster-scoped authentication token with read permissions is required.
func (*Client) ImportDatabase ¶
func (c *Client) ImportDatabase(ctx context.Context, database string, r io.Reader) (ltx.TXID, error)
ImportDatabase creates a new database with the SQLite database contained in r. A cluster-scoped authentication token with write permissions is required.
func (*Client) ListClusters ¶
func (c *Client) ListClusters(ctx context.Context, input *ListClustersInput) (*ListClustersOutput, error)
ListClusters returns a list of clusters for the current organization. An org-scoped authentication token with read permissions is required.
func (*Client) Pos ¶
Pos returns a map of database names with their current replication position. A cluster-scoped authentication token with read permissions is required.
func (*Client) RestoreDatabaseToTimestamp ¶
func (c *Client) RestoreDatabaseToTimestamp(ctx context.Context, database string, timestamp time.Time) (ltx.TXID, error)
RestoreDatabaseToTimestamp reverts the database to the state closest to the given timestamp. A cluster-scoped authentication token with write permissions is required.
type Cluster ¶
type Cluster struct { OrgID int `json:"orgID"` Name string `json:"name"` Region string `json:"region"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Cluster represents a grouping of databases in LiteFS Cloud.