sqlite_remotev1

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SigAlg_name = map[int32]string{
		0: "SIG_ALG_UNSPECIFIED",
		1: "SIG_ALG_ED25519",
	}
	SigAlg_value = map[string]int32{
		"SIG_ALG_UNSPECIFIED": 0,
		"SIG_ALG_ED25519":     1,
	}
)

Enum value maps for SigAlg.

View Source
var (
	ErrorCode_name = map[int32]string{
		0:  "ERROR_CODE_UNSPECIFIED",
		1:  "ERROR_CODE_UNAUTHENTICATED",
		2:  "ERROR_CODE_FORBIDDEN",
		3:  "ERROR_CODE_NOT_FOUND",
		4:  "ERROR_CODE_LEASE_HELD",
		5:  "ERROR_CODE_FENCED",
		6:  "ERROR_CODE_VERSION_CONFLICT",
		7:  "ERROR_CODE_BAD_REQUEST",
		8:  "ERROR_CODE_TOO_LARGE",
		9:  "ERROR_CODE_QUOTA_EXCEEDED",
		10: "ERROR_CODE_RATE_LIMITED",
		11: "ERROR_CODE_INTERNAL",
		12: "ERROR_CODE_ACCESS_DENIED",
	}
	ErrorCode_value = map[string]int32{
		"ERROR_CODE_UNSPECIFIED":      0,
		"ERROR_CODE_UNAUTHENTICATED":  1,
		"ERROR_CODE_FORBIDDEN":        2,
		"ERROR_CODE_NOT_FOUND":        3,
		"ERROR_CODE_LEASE_HELD":       4,
		"ERROR_CODE_FENCED":           5,
		"ERROR_CODE_VERSION_CONFLICT": 6,
		"ERROR_CODE_BAD_REQUEST":      7,
		"ERROR_CODE_TOO_LARGE":        8,
		"ERROR_CODE_QUOTA_EXCEEDED":   9,
		"ERROR_CODE_RATE_LIMITED":     10,
		"ERROR_CODE_INTERNAL":         11,
		"ERROR_CODE_ACCESS_DENIED":    12,
	}
)

Enum value maps for ErrorCode.

View Source
var File_sqlite_remote_v1_sqlite_remote_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Block

type Block struct {

	// Byte offset in the file divided by page_size.
	Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	// Exactly page_size bytes.
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

One block of the database file.

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetData

func (x *Block) GetData() []byte

func (*Block) GetIndex

func (x *Block) GetIndex() uint64

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type Challenge

type Challenge struct {

	// 32 random bytes. Valid for this login only.
	Nonce []byte `protobuf:"bytes,1,opt,name=nonce,proto3" json:"nonce,omitempty"`
	// The server's configured identifier, normally its public WebSocket URL, e.g. "wss://vfs.example/v1/ws". It is
	// part of the signed transcript. A client that compares it with the URL it connected to detects a challenge that
	// another server relays. Browsers do not expose TLS channel binding, so this is the only binding available.
	// sqlite-remote-vfs does not compare it; it expects a separate key for each server instead.
	ServerId string `protobuf:"bytes,2,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"`
	// Deadline for the `Proof`, in milliseconds since the Unix epoch.
	ExpiresAtMs uint64 `protobuf:"varint,3,opt,name=expires_at_ms,json=expiresAtMs,proto3" json:"expires_at_ms,omitempty"`
	// contains filtered or unexported fields
}

Answer to `Hello`, with the Hello's request_id. The client answers with a `Proof`.

func (*Challenge) Descriptor deprecated

func (*Challenge) Descriptor() ([]byte, []int)

Deprecated: Use Challenge.ProtoReflect.Descriptor instead.

func (*Challenge) GetExpiresAtMs

func (x *Challenge) GetExpiresAtMs() uint64

func (*Challenge) GetNonce

func (x *Challenge) GetNonce() []byte

func (*Challenge) GetServerId

func (x *Challenge) GetServerId() string

func (*Challenge) ProtoMessage

func (*Challenge) ProtoMessage()

func (*Challenge) ProtoReflect

func (x *Challenge) ProtoReflect() protoreflect.Message

func (*Challenge) Reset

func (x *Challenge) Reset()

func (*Challenge) String

func (x *Challenge) String() string

type Changed

type Changed struct {
	DbId string `protobuf:"bytes,1,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
	// Version of the client's local copy. Must not be greater than the current version.
	FromVersion uint64 `protobuf:"varint,2,opt,name=from_version,json=fromVersion,proto3" json:"from_version,omitempty"`
	// contains filtered or unexported fields
}

Requests the indexes of all blocks changed since `from_version`. Answered with `Changes`.

Used to catch up a local copy that is a few commits behind. The client discards those blocks from the copy and keeps the rest, instead of fetching the whole database.

func (*Changed) Descriptor deprecated

func (*Changed) Descriptor() ([]byte, []int)

Deprecated: Use Changed.ProtoReflect.Descriptor instead.

func (*Changed) GetDbId

func (x *Changed) GetDbId() string

func (*Changed) GetFromVersion

func (x *Changed) GetFromVersion() uint64

func (*Changed) ProtoMessage

func (*Changed) ProtoMessage()

func (*Changed) ProtoReflect

func (x *Changed) ProtoReflect() protoreflect.Message

func (*Changed) Reset

func (x *Changed) Reset()

func (*Changed) String

func (x *Changed) String() string

type Changes

type Changes struct {
	FromVersion uint64 `protobuf:"varint,1,opt,name=from_version,json=fromVersion,proto3" json:"from_version,omitempty"`
	// The current version.
	ToVersion uint64 `protobuf:"varint,2,opt,name=to_version,json=toVersion,proto3" json:"to_version,omitempty"`
	// Indexes of all blocks written by any commit after `from_version`, ascending and without duplicates.
	Blocks []uint64 `protobuf:"varint,3,rep,packed,name=blocks,proto3" json:"blocks,omitempty"`
	// False if the server's change log does not reach back to `from_version`, or the list does not fit in one frame.
	// `blocks` is then empty and the client has to discard its local copy.
	Complete bool `protobuf:"varint,4,opt,name=complete,proto3" json:"complete,omitempty"`
	// contains filtered or unexported fields
}

Answer to `Changed`.

func (*Changes) Descriptor deprecated

func (*Changes) Descriptor() ([]byte, []int)

Deprecated: Use Changes.ProtoReflect.Descriptor instead.

func (*Changes) GetBlocks

func (x *Changes) GetBlocks() []uint64

func (*Changes) GetComplete

func (x *Changes) GetComplete() bool

func (*Changes) GetFromVersion

func (x *Changes) GetFromVersion() uint64

func (*Changes) GetToVersion

func (x *Changes) GetToVersion() uint64

func (*Changes) ProtoMessage

func (*Changes) ProtoMessage()

func (*Changes) ProtoReflect

func (x *Changes) ProtoReflect() protoreflect.Message

func (*Changes) Reset

func (x *Changes) Reset()

func (*Changes) String

func (x *Changes) String() string

type ClientFrame

type ClientFrame struct {

	// Chosen by the client. Must be greater than 0. Every answer to the request carries the same id.
	RequestId uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
	// 14 is reserved for recovery after a server restore.
	//
	// Types that are valid to be assigned to Body:
	//
	//	*ClientFrame_Hello
	//	*ClientFrame_Open
	//	*ClientFrame_Fetch
	//	*ClientFrame_Commit
	//	*ClientFrame_Ping
	//	*ClientFrame_CloseDb
	//	*ClientFrame_Proof
	//	*ClientFrame_Delete
	//	*ClientFrame_Changed
	Body isClientFrame_Body `protobuf_oneof:"body"`
	// contains filtered or unexported fields
}

A frame from the client to the server.

func (*ClientFrame) Descriptor deprecated

func (*ClientFrame) Descriptor() ([]byte, []int)

Deprecated: Use ClientFrame.ProtoReflect.Descriptor instead.

func (*ClientFrame) GetBody

func (x *ClientFrame) GetBody() isClientFrame_Body

func (*ClientFrame) GetChanged

func (x *ClientFrame) GetChanged() *Changed

func (*ClientFrame) GetCloseDb

func (x *ClientFrame) GetCloseDb() *CloseDb

func (*ClientFrame) GetCommit

func (x *ClientFrame) GetCommit() *Commit

func (*ClientFrame) GetDelete

func (x *ClientFrame) GetDelete() *Delete

func (*ClientFrame) GetFetch

func (x *ClientFrame) GetFetch() *Fetch

func (*ClientFrame) GetHello

func (x *ClientFrame) GetHello() *Hello

func (*ClientFrame) GetOpen

func (x *ClientFrame) GetOpen() *Open

func (*ClientFrame) GetPing

func (x *ClientFrame) GetPing() *Ping

func (*ClientFrame) GetProof

func (x *ClientFrame) GetProof() *Proof

func (*ClientFrame) GetRequestId

func (x *ClientFrame) GetRequestId() uint64

func (*ClientFrame) ProtoMessage

func (*ClientFrame) ProtoMessage()

func (*ClientFrame) ProtoReflect

func (x *ClientFrame) ProtoReflect() protoreflect.Message

func (*ClientFrame) Reset

func (x *ClientFrame) Reset()

func (*ClientFrame) String

func (x *ClientFrame) String() string

type ClientFrame_Changed

type ClientFrame_Changed struct {
	Changed *Changed `protobuf:"bytes,19,opt,name=changed,proto3,oneof"`
}

type ClientFrame_CloseDb

type ClientFrame_CloseDb struct {
	CloseDb *CloseDb `protobuf:"bytes,16,opt,name=close_db,json=closeDb,proto3,oneof"`
}

type ClientFrame_Commit

type ClientFrame_Commit struct {
	Commit *Commit `protobuf:"bytes,13,opt,name=commit,proto3,oneof"`
}

type ClientFrame_Delete

type ClientFrame_Delete struct {
	Delete *Delete `protobuf:"bytes,18,opt,name=delete,proto3,oneof"`
}

type ClientFrame_Fetch

type ClientFrame_Fetch struct {
	Fetch *Fetch `protobuf:"bytes,12,opt,name=fetch,proto3,oneof"`
}

type ClientFrame_Hello

type ClientFrame_Hello struct {
	Hello *Hello `protobuf:"bytes,10,opt,name=hello,proto3,oneof"`
}

type ClientFrame_Open

type ClientFrame_Open struct {
	Open *Open `protobuf:"bytes,11,opt,name=open,proto3,oneof"`
}

type ClientFrame_Ping

type ClientFrame_Ping struct {
	Ping *Ping `protobuf:"bytes,15,opt,name=ping,proto3,oneof"`
}

type ClientFrame_Proof

type ClientFrame_Proof struct {
	Proof *Proof `protobuf:"bytes,17,opt,name=proof,proto3,oneof"`
}

type CloseDb

type CloseDb struct {
	DbId       string `protobuf:"bytes,1,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
	LeaseEpoch uint64 `protobuf:"varint,2,opt,name=lease_epoch,json=leaseEpoch,proto3" json:"lease_epoch,omitempty"`
	// contains filtered or unexported fields
}

Releases the lease of a database immediately. Answered with `Ok`.

func (*CloseDb) Descriptor deprecated

func (*CloseDb) Descriptor() ([]byte, []int)

Deprecated: Use CloseDb.ProtoReflect.Descriptor instead.

func (*CloseDb) GetDbId

func (x *CloseDb) GetDbId() string

func (*CloseDb) GetLeaseEpoch

func (x *CloseDb) GetLeaseEpoch() uint64

func (*CloseDb) ProtoMessage

func (*CloseDb) ProtoMessage()

func (*CloseDb) ProtoReflect

func (x *CloseDb) ProtoReflect() protoreflect.Message

func (*CloseDb) Reset

func (x *CloseDb) Reset()

func (*CloseDb) String

func (x *CloseDb) String() string

type Commit

type Commit struct {
	DbId string `protobuf:"bytes,1,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
	// 16 random bytes, the same in every part. Makes a repeated commit idempotent: if the last applied commit has this
	// id and the version is base_version + 1, the server answers with that version again.
	CommitId []byte `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
	// Current lease epoch, otherwise ERROR_CODE_FENCED.
	LeaseEpoch uint64 `protobuf:"varint,3,opt,name=lease_epoch,json=leaseEpoch,proto3" json:"lease_epoch,omitempty"`
	// Version the commit is based on. Must be the current version, otherwise ERROR_CODE_VERSION_CONFLICT.
	BaseVersion uint64 `protobuf:"varint,4,opt,name=base_version,json=baseVersion,proto3" json:"base_version,omitempty"`
	// Length of the database file after the commit, in blocks. Blocks at or beyond it are removed.
	PageCount uint64   `protobuf:"varint,5,opt,name=page_count,json=pageCount,proto3" json:"page_count,omitempty"`
	Blocks    []*Block `protobuf:"bytes,6,rep,name=blocks,proto3" json:"blocks,omitempty"`
	// True if more parts of this commit follow.
	More bool `protobuf:"varint,7,opt,name=more,proto3" json:"more,omitempty"`
	// Number of this part within the commit, starting at 0. Part 0 starts a new commit and discards an incomplete one.
	// Every further part must directly follow the previous part and repeat its commit_id, lease_epoch, base_version
	// and page_count. Otherwise the server refuses it and discards the commit, so later parts cannot be applied on
	// their own. This keeps a commit atomic although the client sends all parts without waiting for answers.
	Part uint32 `protobuf:"varint,8,opt,name=part,proto3" json:"part,omitempty"`
	// contains filtered or unexported fields
}

One frame (part) of a commit: blocks changed by one or more SQLite transactions. The server applies a commit atomically. Only the last part is answered, with `CommitAck` or `Error`. A refused part is answered with `Error` at once.

func (*Commit) Descriptor deprecated

func (*Commit) Descriptor() ([]byte, []int)

Deprecated: Use Commit.ProtoReflect.Descriptor instead.

func (*Commit) GetBaseVersion

func (x *Commit) GetBaseVersion() uint64

func (*Commit) GetBlocks

func (x *Commit) GetBlocks() []*Block

func (*Commit) GetCommitId

func (x *Commit) GetCommitId() []byte

func (*Commit) GetDbId

func (x *Commit) GetDbId() string

func (*Commit) GetLeaseEpoch

func (x *Commit) GetLeaseEpoch() uint64

func (*Commit) GetMore

func (x *Commit) GetMore() bool

func (*Commit) GetPageCount

func (x *Commit) GetPageCount() uint64

func (*Commit) GetPart

func (x *Commit) GetPart() uint32

func (*Commit) ProtoMessage

func (*Commit) ProtoMessage()

func (*Commit) ProtoReflect

func (x *Commit) ProtoReflect() protoreflect.Message

func (*Commit) Reset

func (x *Commit) Reset()

func (*Commit) String

func (x *Commit) String() string

type CommitAck

type CommitAck struct {
	CommitId []byte `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
	// Version after the commit.
	Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

Answer to the last part of an applied `Commit`. The commit is durable when this is sent.

func (*CommitAck) Descriptor deprecated

func (*CommitAck) Descriptor() ([]byte, []int)

Deprecated: Use CommitAck.ProtoReflect.Descriptor instead.

func (*CommitAck) GetCommitId

func (x *CommitAck) GetCommitId() []byte

func (*CommitAck) GetVersion

func (x *CommitAck) GetVersion() uint64

func (*CommitAck) ProtoMessage

func (*CommitAck) ProtoMessage()

func (*CommitAck) ProtoReflect

func (x *CommitAck) ProtoReflect() protoreflect.Message

func (*CommitAck) Reset

func (x *CommitAck) Reset()

func (*CommitAck) String

func (x *CommitAck) String() string

type Delete

type Delete struct {
	DbId string `protobuf:"bytes,1,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
	// Deletes even if another instance holds a lease that has not expired. That instance receives `LeaseRevoked`.
	// Without it, the request fails with ERROR_CODE_LEASE_HELD in that case.
	Takeover bool `protobuf:"varint,2,opt,name=takeover,proto3" json:"takeover,omitempty"`
	// contains filtered or unexported fields
}

Deletes a database: its blocks and its change log. Answered with `Ok`, also if the database does not exist or was already deleted, so that a repeated request succeeds.

The database must not be open on this connection. The server keeps a record of the deleted database with its lease epoch and version, and increases the epoch, so that no earlier lease can commit again. Opening the database again with `create_if_missing` creates it empty with any page size; the epoch and the version continue from the deleted database. Opening it without `create_if_missing` fails with ERROR_CODE_NOT_FOUND.

func (*Delete) Descriptor deprecated

func (*Delete) Descriptor() ([]byte, []int)

Deprecated: Use Delete.ProtoReflect.Descriptor instead.

func (*Delete) GetDbId

func (x *Delete) GetDbId() string

func (*Delete) GetTakeover

func (x *Delete) GetTakeover() bool

func (*Delete) ProtoMessage

func (*Delete) ProtoMessage()

func (*Delete) ProtoReflect

func (x *Delete) ProtoReflect() protoreflect.Message

func (*Delete) Reset

func (x *Delete) Reset()

func (*Delete) String

func (x *Delete) String() string

type Error

type Error struct {
	Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=sqlite_remote.v1.ErrorCode" json:"code,omitempty"`
	// Human-readable reason. For ERROR_CODE_INTERNAL it contains no details.
	Detail string `protobuf:"bytes,2,opt,name=detail,proto3" json:"detail,omitempty"`
	// Current version of the database. Set with ERROR_CODE_VERSION_CONFLICT.
	CurrentVersion uint64 `protobuf:"varint,3,opt,name=current_version,json=currentVersion,proto3" json:"current_version,omitempty"`
	// Time the current lease was granted, in milliseconds since the Unix epoch. Set with ERROR_CODE_LEASE_HELD.
	LeaseHolderSinceMs uint64 `protobuf:"varint,4,opt,name=lease_holder_since_ms,json=leaseHolderSinceMs,proto3" json:"lease_holder_since_ms,omitempty"`
	// contains filtered or unexported fields
}

Answer to a failed request.

func (*Error) Descriptor deprecated

func (*Error) Descriptor() ([]byte, []int)

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() ErrorCode

func (*Error) GetCurrentVersion

func (x *Error) GetCurrentVersion() uint64

func (*Error) GetDetail

func (x *Error) GetDetail() string

func (*Error) GetLeaseHolderSinceMs

func (x *Error) GetLeaseHolderSinceMs() uint64

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

func (x *Error) ProtoReflect() protoreflect.Message

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type ErrorCode

type ErrorCode int32
const (
	ErrorCode_ERROR_CODE_UNSPECIFIED ErrorCode = 0
	// Login failed: no valid `Proof`, an expired challenge, or a request before the login.
	ErrorCode_ERROR_CODE_UNAUTHENTICATED ErrorCode = 1
	// The database belongs to another subject.
	ErrorCode_ERROR_CODE_FORBIDDEN ErrorCode = 2
	// The database does not exist or was deleted.
	ErrorCode_ERROR_CODE_NOT_FOUND ErrorCode = 3
	// Another instance holds a lease that has not expired.
	ErrorCode_ERROR_CODE_LEASE_HELD ErrorCode = 4
	// The lease epoch is not the current one: another instance acquired the lease, or it was released.
	ErrorCode_ERROR_CODE_FENCED ErrorCode = 5
	// The request is based on a version other than the current one. See `Error.current_version`.
	ErrorCode_ERROR_CODE_VERSION_CONFLICT ErrorCode = 6
	// The request is invalid and cannot succeed when repeated, e.g. a block of the wrong size, a block index at or
	// beyond page_count, or a commit part that does not continue the pending commit.
	ErrorCode_ERROR_CODE_BAD_REQUEST ErrorCode = 7
	// The commit exceeds the server's size limit for one commit.
	ErrorCode_ERROR_CODE_TOO_LARGE      ErrorCode = 8
	ErrorCode_ERROR_CODE_QUOTA_EXCEEDED ErrorCode = 9
	ErrorCode_ERROR_CODE_RATE_LIMITED   ErrorCode = 10
	// Unexpected error on the server. Details are only in the server's log.
	ErrorCode_ERROR_CODE_INTERNAL ErrorCode = 11
	// The server requires an access token (`Hello.access_token`), and the token is missing, invalid, expired, or bound
	// to another key.
	ErrorCode_ERROR_CODE_ACCESS_DENIED ErrorCode = 12
)

func (ErrorCode) Descriptor

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated

func (ErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type

type Fetch

type Fetch struct {
	DbId string `protobuf:"bytes,1,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
	// Must be the current version. Otherwise the request fails with ERROR_CODE_VERSION_CONFLICT.
	Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	// One range: `count` blocks starting at `first_block`. Ignored if `ranges` is set.
	FirstBlock uint64 `protobuf:"varint,3,opt,name=first_block,json=firstBlock,proto3" json:"first_block,omitempty"`
	Count      uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
	// Several ranges, in ascending order and without overlap. At most 4096. Blocks that were never written are
	// returned as zeros.
	Ranges []*Range `protobuf:"bytes,5,rep,name=ranges,proto3" json:"ranges,omitempty"`
	// contains filtered or unexported fields
}

Requests blocks as of `version`. Either one range (`first_block` and `count`) or several (`ranges`). Answered with one or more `Pages` frames.

Several ranges in one request are for catching up a local copy. The blocks changed by a series of commits are spread across the file, and one request per range would cost one round trip each.

func (*Fetch) Descriptor deprecated

func (*Fetch) Descriptor() ([]byte, []int)

Deprecated: Use Fetch.ProtoReflect.Descriptor instead.

func (*Fetch) GetCount

func (x *Fetch) GetCount() uint64

func (*Fetch) GetDbId

func (x *Fetch) GetDbId() string

func (*Fetch) GetFirstBlock

func (x *Fetch) GetFirstBlock() uint64

func (*Fetch) GetRanges

func (x *Fetch) GetRanges() []*Range

func (*Fetch) GetVersion

func (x *Fetch) GetVersion() uint64

func (*Fetch) ProtoMessage

func (*Fetch) ProtoMessage()

func (*Fetch) ProtoReflect

func (x *Fetch) ProtoReflect() protoreflect.Message

func (*Fetch) Reset

func (x *Fetch) Reset()

func (*Fetch) String

func (x *Fetch) String() string

type Hello

type Hello struct {

	// Protocol version of the client. The server rejects a version other than its own with ERROR_CODE_BAD_REQUEST.
	ProtocolVersion uint32 `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
	// Id of the client instance, e.g. one browser tab or worker. 1 to 64 bytes. Usually random. A client that restarts
	// may use the same id again to take back its own lease without takeover, see `Open.takeover`. Two instances that run
	// at the same time must not use the same id.
	InstanceId []byte `protobuf:"bytes,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"`
	// Algorithm and public key of the client's key pair. The client proves possession of the private key with a
	// `Proof`. The server derives the subject from the public key. The subject determines which databases the
	// connection can access. A client has no other way to select a subject.
	SigAlg    SigAlg `protobuf:"varint,3,opt,name=sig_alg,json=sigAlg,proto3,enum=sqlite_remote.v1.SigAlg" json:"sig_alg,omitempty"`
	PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// Access token, for a server that admits only clients with one. A signed JWT whose `cnf` claim binds it to
	// `public_key`, so that it is useless without the private key. The server checks it before the `Challenge` and
	// rejects a missing, invalid or expired token, or one bound to another key, with ERROR_CODE_ACCESS_DENIED. A server
	// without such a requirement ignores the field. See `HelloOk.access_token_ttl_ms`.
	AccessToken string `protobuf:"bytes,5,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` // 6 is reserved for a second signature algorithm.
	// contains filtered or unexported fields
}

First frame on a connection. The server answers with a `Challenge`, or with an `Error` if the frame is invalid or the access token is rejected.

func (*Hello) Descriptor deprecated

func (*Hello) Descriptor() ([]byte, []int)

Deprecated: Use Hello.ProtoReflect.Descriptor instead.

func (*Hello) GetAccessToken

func (x *Hello) GetAccessToken() string

func (*Hello) GetInstanceId

func (x *Hello) GetInstanceId() []byte

func (*Hello) GetProtocolVersion

func (x *Hello) GetProtocolVersion() uint32

func (*Hello) GetPublicKey

func (x *Hello) GetPublicKey() []byte

func (*Hello) GetSigAlg

func (x *Hello) GetSigAlg() SigAlg

func (*Hello) ProtoMessage

func (*Hello) ProtoMessage()

func (*Hello) ProtoReflect

func (x *Hello) ProtoReflect() protoreflect.Message

func (*Hello) Reset

func (x *Hello) Reset()

func (*Hello) String

func (x *Hello) String() string

type HelloOk

type HelloOk struct {

	// Protocol version of the server.
	ProtocolVersion uint32 `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
	// Largest frame the server accepts, in bytes. The client splits a commit into parts that fit.
	MaxFrameBytes uint32 `protobuf:"varint,2,opt,name=max_frame_bytes,json=maxFrameBytes,proto3" json:"max_frame_bytes,omitempty"`
	// Interval at which the client sends a `Ping` while it is otherwise idle, in milliseconds.
	PingIntervalMs uint32 `protobuf:"varint,3,opt,name=ping_interval_ms,json=pingIntervalMs,proto3" json:"ping_interval_ms,omitempty"`
	// Time after the last renewal from which another instance can acquire the lease without `takeover`, in
	// milliseconds. Commits and pings renew the lease.
	LeaseTtlMs uint32 `protobuf:"varint,4,opt,name=lease_ttl_ms,json=leaseTtlMs,proto3" json:"lease_ttl_ms,omitempty"`
	// Remaining lifetime of the access token in milliseconds, 0 without a token. Relative, so that the clocks of client
	// and server need not agree. The client reconnects with a new token before this time has passed, between two
	// requests. Shortly after it has passed, the server closes the connection at the next frame.
	AccessTokenTtlMs uint64 `protobuf:"varint,5,opt,name=access_token_ttl_ms,json=accessTokenTtlMs,proto3" json:"access_token_ttl_ms,omitempty"`
	// contains filtered or unexported fields
}

Answer to a valid `Proof`, with the Proof's request_id. Completes the login and carries the server's limits.

func (*HelloOk) Descriptor deprecated

func (*HelloOk) Descriptor() ([]byte, []int)

Deprecated: Use HelloOk.ProtoReflect.Descriptor instead.

func (*HelloOk) GetAccessTokenTtlMs

func (x *HelloOk) GetAccessTokenTtlMs() uint64

func (*HelloOk) GetLeaseTtlMs

func (x *HelloOk) GetLeaseTtlMs() uint32

func (*HelloOk) GetMaxFrameBytes

func (x *HelloOk) GetMaxFrameBytes() uint32

func (*HelloOk) GetPingIntervalMs

func (x *HelloOk) GetPingIntervalMs() uint32

func (*HelloOk) GetProtocolVersion

func (x *HelloOk) GetProtocolVersion() uint32

func (*HelloOk) ProtoMessage

func (*HelloOk) ProtoMessage()

func (*HelloOk) ProtoReflect

func (x *HelloOk) ProtoReflect() protoreflect.Message

func (*HelloOk) Reset

func (x *HelloOk) Reset()

func (*HelloOk) String

func (x *HelloOk) String() string

type LeaseRevoked

type LeaseRevoked struct {
	DbId          string `protobuf:"bytes,1,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
	NewLeaseEpoch uint64 `protobuf:"varint,2,opt,name=new_lease_epoch,json=newLeaseEpoch,proto3" json:"new_lease_epoch,omitempty"`
	// contains filtered or unexported fields
}

Sent unprompted (request_id 0) when another instance has acquired the lease of a database open on this connection. Delivery is not guaranteed. A client that missed it gets ERROR_CODE_FENCED on its next commit.

func (*LeaseRevoked) Descriptor deprecated

func (*LeaseRevoked) Descriptor() ([]byte, []int)

Deprecated: Use LeaseRevoked.ProtoReflect.Descriptor instead.

func (*LeaseRevoked) GetDbId

func (x *LeaseRevoked) GetDbId() string

func (*LeaseRevoked) GetNewLeaseEpoch

func (x *LeaseRevoked) GetNewLeaseEpoch() uint64

func (*LeaseRevoked) ProtoMessage

func (*LeaseRevoked) ProtoMessage()

func (*LeaseRevoked) ProtoReflect

func (x *LeaseRevoked) ProtoReflect() protoreflect.Message

func (*LeaseRevoked) Reset

func (x *LeaseRevoked) Reset()

func (*LeaseRevoked) String

func (x *LeaseRevoked) String() string

type Ok

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

Answer to a request that returns no data, e.g. `CloseDb`.

func (*Ok) Descriptor deprecated

func (*Ok) Descriptor() ([]byte, []int)

Deprecated: Use Ok.ProtoReflect.Descriptor instead.

func (*Ok) ProtoMessage

func (*Ok) ProtoMessage()

func (*Ok) ProtoReflect

func (x *Ok) ProtoReflect() protoreflect.Message

func (*Ok) Reset

func (x *Ok) Reset()

func (*Ok) String

func (x *Ok) String() string

type Open

type Open struct {

	// Name of the database within the subject. 1 to 128 bytes of UTF-8.
	DbId string `protobuf:"bytes,1,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
	// Page size of a new database. For an existing database it must be 0 or equal to the database's page size.
	PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// Creates the database if it does not exist or was deleted. Without it, such a database fails with
	// ERROR_CODE_NOT_FOUND.
	CreateIfMissing bool `protobuf:"varint,3,opt,name=create_if_missing,json=createIfMissing,proto3" json:"create_if_missing,omitempty"`
	// Acquires the lease even if another instance holds one that has not expired. Without it, the open fails with
	// ERROR_CODE_LEASE_HELD in that case. The instance that holds the lease, identified by `Hello.instance_id`, gets a
	// new lease without it: a client that restarted has lost its lease id and cannot resume. Its earlier lease is fenced.
	Takeover bool `protobuf:"varint,4,opt,name=takeover,proto3" json:"takeover,omitempty"`
	// Set only when reopening after a broken connection. Continues the previous lease instead of acquiring a new one.
	Resume *Resume `protobuf:"bytes,5,opt,name=resume,proto3" json:"resume,omitempty"`
	// contains filtered or unexported fields
}

Opens a database and acquires its lease, the exclusive right to commit to it. Answered with `Opened`.

func (*Open) Descriptor deprecated

func (*Open) Descriptor() ([]byte, []int)

Deprecated: Use Open.ProtoReflect.Descriptor instead.

func (*Open) GetCreateIfMissing

func (x *Open) GetCreateIfMissing() bool

func (*Open) GetDbId

func (x *Open) GetDbId() string

func (*Open) GetPageSize

func (x *Open) GetPageSize() uint32

func (*Open) GetResume

func (x *Open) GetResume() *Resume

func (*Open) GetTakeover

func (x *Open) GetTakeover() bool

func (*Open) ProtoMessage

func (*Open) ProtoMessage()

func (*Open) ProtoReflect

func (x *Open) ProtoReflect() protoreflect.Message

func (*Open) Reset

func (x *Open) Reset()

func (*Open) String

func (x *Open) String() string

type Opened

type Opened struct {
	LeaseId []byte `protobuf:"bytes,1,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"`
	// Fencing token. Every new lease has a higher epoch. A `Commit` must carry the current epoch, otherwise it fails
	// with ERROR_CODE_FENCED.
	LeaseEpoch uint64 `protobuf:"varint,2,opt,name=lease_epoch,json=leaseEpoch,proto3" json:"lease_epoch,omitempty"`
	// Current version. Every applied commit and every deletion increases it by 1.
	Version  uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	PageSize uint32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// Length of the database file, in blocks.
	PageCount uint64 `protobuf:"varint,5,opt,name=page_count,json=pageCount,proto3" json:"page_count,omitempty"`
	// commit_id of the last applied commit. A client whose commit was not acknowledged compares it with its own
	// commit_id to find out whether the commit was applied.
	LastCommitId []byte `protobuf:"bytes,6,opt,name=last_commit_id,json=lastCommitId,proto3" json:"last_commit_id,omitempty"`
	// contains filtered or unexported fields
}

Answer to `Open`: the lease and the current state of the database.

func (*Opened) Descriptor deprecated

func (*Opened) Descriptor() ([]byte, []int)

Deprecated: Use Opened.ProtoReflect.Descriptor instead.

func (*Opened) GetLastCommitId

func (x *Opened) GetLastCommitId() []byte

func (*Opened) GetLeaseEpoch

func (x *Opened) GetLeaseEpoch() uint64

func (*Opened) GetLeaseId

func (x *Opened) GetLeaseId() []byte

func (*Opened) GetPageCount

func (x *Opened) GetPageCount() uint64

func (*Opened) GetPageSize

func (x *Opened) GetPageSize() uint32

func (*Opened) GetVersion

func (x *Opened) GetVersion() uint64

func (*Opened) ProtoMessage

func (*Opened) ProtoMessage()

func (*Opened) ProtoReflect

func (x *Opened) ProtoReflect() protoreflect.Message

func (*Opened) Reset

func (x *Opened) Reset()

func (*Opened) String

func (x *Opened) String() string

type Pages

type Pages struct {

	// Index of the first block in this frame.
	FirstBlock uint64 `protobuf:"varint,1,opt,name=first_block,json=firstBlock,proto3" json:"first_block,omitempty"`
	// Consecutive blocks from `first_block`, each exactly page_size bytes.
	Blocks [][]byte `protobuf:"bytes,2,rep,name=blocks,proto3" json:"blocks,omitempty"`
	// True on the last frame of the answer.
	Last bool `protobuf:"varint,3,opt,name=last,proto3" json:"last,omitempty"`
	// contains filtered or unexported fields
}

Blocks answering a `Fetch`, with the Fetch's request_id. The server sends the ranges in the requested order and splits them across as many frames as needed. A frame never contains blocks from two ranges.

func (*Pages) Descriptor deprecated

func (*Pages) Descriptor() ([]byte, []int)

Deprecated: Use Pages.ProtoReflect.Descriptor instead.

func (*Pages) GetBlocks

func (x *Pages) GetBlocks() [][]byte

func (*Pages) GetFirstBlock

func (x *Pages) GetFirstBlock() uint64

func (*Pages) GetLast

func (x *Pages) GetLast() bool

func (*Pages) ProtoMessage

func (*Pages) ProtoMessage()

func (*Pages) ProtoReflect

func (x *Pages) ProtoReflect() protoreflect.Message

func (*Pages) Reset

func (x *Pages) Reset()

func (*Pages) String

func (x *Pages) String() string

type Ping

type Ping struct {

	// Client clock in milliseconds. Returned unchanged in the `Pong`.
	ClientTimeMs uint64 `protobuf:"varint,1,opt,name=client_time_ms,json=clientTimeMs,proto3" json:"client_time_ms,omitempty"`
	// contains filtered or unexported fields
}

Keeps the connection open and renews the leases of all databases open on it. The server renews a lease only if at least half of lease_ttl_ms has passed since its last renewal. Answered with `Pong`.

func (*Ping) Descriptor deprecated

func (*Ping) Descriptor() ([]byte, []int)

Deprecated: Use Ping.ProtoReflect.Descriptor instead.

func (*Ping) GetClientTimeMs

func (x *Ping) GetClientTimeMs() uint64

func (*Ping) ProtoMessage

func (*Ping) ProtoMessage()

func (*Ping) ProtoReflect

func (x *Ping) ProtoReflect() protoreflect.Message

func (*Ping) Reset

func (x *Ping) Reset()

func (*Ping) String

func (x *Ping) String() string

type Pong

type Pong struct {
	ClientTimeMs uint64 `protobuf:"varint,1,opt,name=client_time_ms,json=clientTimeMs,proto3" json:"client_time_ms,omitempty"`
	// contains filtered or unexported fields
}

Answer to `Ping`.

func (*Pong) Descriptor deprecated

func (*Pong) Descriptor() ([]byte, []int)

Deprecated: Use Pong.ProtoReflect.Descriptor instead.

func (*Pong) GetClientTimeMs

func (x *Pong) GetClientTimeMs() uint64

func (*Pong) ProtoMessage

func (*Pong) ProtoMessage()

func (*Pong) ProtoReflect

func (x *Pong) ProtoReflect() protoreflect.Message

func (*Pong) Reset

func (x *Pong) Reset()

func (*Pong) String

func (x *Pong) String() string

type Proof

type Proof struct {
	Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

Answer to `Challenge`. The server answers with `HelloOk`, or with an `Error` (ERROR_CODE_UNAUTHENTICATED), both with the Proof's request_id.

`signature` is the signature over the following transcript. Each part is preceded by its length as a 4-byte big-endian integer:

"sqlite-remote-auth-v1" || server_id || nonce || instance_id || sig_alg || public_key

sig_alg is the enum value as a 4-byte big-endian integer.

func (*Proof) Descriptor deprecated

func (*Proof) Descriptor() ([]byte, []int)

Deprecated: Use Proof.ProtoReflect.Descriptor instead.

func (*Proof) GetSignature

func (x *Proof) GetSignature() []byte

func (*Proof) ProtoMessage

func (*Proof) ProtoMessage()

func (*Proof) ProtoReflect

func (x *Proof) ProtoReflect() protoreflect.Message

func (*Proof) Reset

func (x *Proof) Reset()

func (*Proof) String

func (x *Proof) String() string

type Range

type Range struct {
	FirstBlock uint64 `protobuf:"varint,1,opt,name=first_block,json=firstBlock,proto3" json:"first_block,omitempty"`
	Count      uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
	// contains filtered or unexported fields
}

A range of consecutive blocks.

func (*Range) Descriptor deprecated

func (*Range) Descriptor() ([]byte, []int)

Deprecated: Use Range.ProtoReflect.Descriptor instead.

func (*Range) GetCount

func (x *Range) GetCount() uint64

func (*Range) GetFirstBlock

func (x *Range) GetFirstBlock() uint64

func (*Range) ProtoMessage

func (*Range) ProtoMessage()

func (*Range) ProtoReflect

func (x *Range) ProtoReflect() protoreflect.Message

func (*Range) Reset

func (x *Range) Reset()

func (*Range) String

func (x *Range) String() string

type Resume

type Resume struct {

	// lease_id and lease_epoch from the previous `Opened`. If the lease is no longer current, the open fails with
	// ERROR_CODE_FENCED.
	LeaseId    []byte `protobuf:"bytes,1,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"`
	LeaseEpoch uint64 `protobuf:"varint,2,opt,name=lease_epoch,json=leaseEpoch,proto3" json:"lease_epoch,omitempty"`
	// The last version the server acknowledged to this client.
	KnownVersion uint64 `protobuf:"varint,3,opt,name=known_version,json=knownVersion,proto3" json:"known_version,omitempty"`
	// commit_id of a commit that was sent but not acknowledged. Empty if there is none.
	PendingCommitId []byte `protobuf:"bytes,4,opt,name=pending_commit_id,json=pendingCommitId,proto3" json:"pending_commit_id,omitempty"`
	// contains filtered or unexported fields
}

The previous lease and state, for reopening after a broken connection.

func (*Resume) Descriptor deprecated

func (*Resume) Descriptor() ([]byte, []int)

Deprecated: Use Resume.ProtoReflect.Descriptor instead.

func (*Resume) GetKnownVersion

func (x *Resume) GetKnownVersion() uint64

func (*Resume) GetLeaseEpoch

func (x *Resume) GetLeaseEpoch() uint64

func (*Resume) GetLeaseId

func (x *Resume) GetLeaseId() []byte

func (*Resume) GetPendingCommitId

func (x *Resume) GetPendingCommitId() []byte

func (*Resume) ProtoMessage

func (*Resume) ProtoMessage()

func (*Resume) ProtoReflect

func (x *Resume) ProtoReflect() protoreflect.Message

func (*Resume) Reset

func (x *Resume) Reset()

func (*Resume) String

func (x *Resume) String() string

type ServerFrame

type ServerFrame struct {

	// The request_id of the request this frame answers. 0 for a frame the server sends unprompted (`LeaseRevoked`).
	RequestId uint64 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
	// Types that are valid to be assigned to Body:
	//
	//	*ServerFrame_HelloOk
	//	*ServerFrame_Opened
	//	*ServerFrame_Pages
	//	*ServerFrame_CommitAck
	//	*ServerFrame_Pong
	//	*ServerFrame_LeaseRevoked
	//	*ServerFrame_Error
	//	*ServerFrame_Ok
	//	*ServerFrame_Challenge
	//	*ServerFrame_Changes
	Body isServerFrame_Body `protobuf_oneof:"body"`
	// contains filtered or unexported fields
}

A frame from the server to the client.

func (*ServerFrame) Descriptor deprecated

func (*ServerFrame) Descriptor() ([]byte, []int)

Deprecated: Use ServerFrame.ProtoReflect.Descriptor instead.

func (*ServerFrame) GetBody

func (x *ServerFrame) GetBody() isServerFrame_Body

func (*ServerFrame) GetChallenge

func (x *ServerFrame) GetChallenge() *Challenge

func (*ServerFrame) GetChanges

func (x *ServerFrame) GetChanges() *Changes

func (*ServerFrame) GetCommitAck

func (x *ServerFrame) GetCommitAck() *CommitAck

func (*ServerFrame) GetError

func (x *ServerFrame) GetError() *Error

func (*ServerFrame) GetHelloOk

func (x *ServerFrame) GetHelloOk() *HelloOk

func (*ServerFrame) GetLeaseRevoked

func (x *ServerFrame) GetLeaseRevoked() *LeaseRevoked

func (*ServerFrame) GetOk

func (x *ServerFrame) GetOk() *Ok

func (*ServerFrame) GetOpened

func (x *ServerFrame) GetOpened() *Opened

func (*ServerFrame) GetPages

func (x *ServerFrame) GetPages() *Pages

func (*ServerFrame) GetPong

func (x *ServerFrame) GetPong() *Pong

func (*ServerFrame) GetRequestId

func (x *ServerFrame) GetRequestId() uint64

func (*ServerFrame) ProtoMessage

func (*ServerFrame) ProtoMessage()

func (*ServerFrame) ProtoReflect

func (x *ServerFrame) ProtoReflect() protoreflect.Message

func (*ServerFrame) Reset

func (x *ServerFrame) Reset()

func (*ServerFrame) String

func (x *ServerFrame) String() string

type ServerFrame_Challenge

type ServerFrame_Challenge struct {
	Challenge *Challenge `protobuf:"bytes,18,opt,name=challenge,proto3,oneof"`
}

type ServerFrame_Changes

type ServerFrame_Changes struct {
	Changes *Changes `protobuf:"bytes,19,opt,name=changes,proto3,oneof"`
}

type ServerFrame_CommitAck

type ServerFrame_CommitAck struct {
	CommitAck *CommitAck `protobuf:"bytes,13,opt,name=commit_ack,json=commitAck,proto3,oneof"`
}

type ServerFrame_Error

type ServerFrame_Error struct {
	Error *Error `protobuf:"bytes,16,opt,name=error,proto3,oneof"`
}

type ServerFrame_HelloOk

type ServerFrame_HelloOk struct {
	HelloOk *HelloOk `protobuf:"bytes,10,opt,name=hello_ok,json=helloOk,proto3,oneof"`
}

type ServerFrame_LeaseRevoked

type ServerFrame_LeaseRevoked struct {
	LeaseRevoked *LeaseRevoked `protobuf:"bytes,15,opt,name=lease_revoked,json=leaseRevoked,proto3,oneof"`
}

type ServerFrame_Ok

type ServerFrame_Ok struct {
	Ok *Ok `protobuf:"bytes,17,opt,name=ok,proto3,oneof"`
}

type ServerFrame_Opened

type ServerFrame_Opened struct {
	Opened *Opened `protobuf:"bytes,11,opt,name=opened,proto3,oneof"`
}

type ServerFrame_Pages

type ServerFrame_Pages struct {
	Pages *Pages `protobuf:"bytes,12,opt,name=pages,proto3,oneof"`
}

type ServerFrame_Pong

type ServerFrame_Pong struct {
	Pong *Pong `protobuf:"bytes,14,opt,name=pong,proto3,oneof"`
}

type SigAlg

type SigAlg int32

Signature algorithm of the client's key pair.

const (
	SigAlg_SIG_ALG_UNSPECIFIED SigAlg = 0
	SigAlg_SIG_ALG_ED25519     SigAlg = 1
)

func (SigAlg) Descriptor

func (SigAlg) Descriptor() protoreflect.EnumDescriptor

func (SigAlg) Enum

func (x SigAlg) Enum() *SigAlg

func (SigAlg) EnumDescriptor deprecated

func (SigAlg) EnumDescriptor() ([]byte, []int)

Deprecated: Use SigAlg.Descriptor instead.

func (SigAlg) Number

func (x SigAlg) Number() protoreflect.EnumNumber

func (SigAlg) String

func (x SigAlg) String() string

func (SigAlg) Type

func (SigAlg) Type() protoreflect.EnumType

Jump to

Keyboard shortcuts

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