syncbase

package
v0.0.0-...-0921c0e Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package syncbase defines the wire API for a structured store that supports peer-to-peer synchronization.

TODO(sadovsky): Write a detailed package description, or provide a reference to the Syncbase documentation.

Security notes: The Syncbase service uses permissions tags from v23/security/access.Tag, restricted on each hierarchy level to tags used at that level: - Valid Service permissions tags are all v23/security/access.Tag tags. - Valid Database permissions tags are Admin, Read, Write, Resolve. - Valid Collection permissions tags are Admin, Read, Write. - Valid Syncgroup permissions tags are Admin, Read. Other tags are not allowed and are reserved for future use. Unless stated otherwise, each permissions tag requirement on a method also implies requiring Resolve on all levels of hierarchy up to, but excluding, the level requiring the tag. ErrNoAccess, Err[No]Exist, ErrUnknownBatch are only returned if the caller is allowed to call Exists on the receiver of the RPC (or the first missing component of the hierarchy to the receiver); otherwise, the returned error is ErrNoExistOrNoAccess.

Index

Constants

View Source
const BlobDevTypeLeaf = int32(2) // Blobs migrate from leaves, which have less storage (examples: a camera, phone)
View Source
const BlobDevTypeNormal = int32(0) // Ordinary devices (example: laptop); uses 0 value because that's the default.
View Source
const BlobDevTypeServer = int32(1) // Blobs migrate toward servers, which store them.  (example: server in cloud)
View Source
const DiscoveryAttrDatabaseBlessing = "db"

DiscoveryAttrDatabaseBlessing is the app blessing component of a database ID, that this syncgroup is a part of.

View Source
const DiscoveryAttrDatabaseName = "d"

DiscoveryAttrDatabaseName is the name component of a database ID, that this syncgroup is a part of.

View Source
const DiscoveryAttrPeer = "p"

DiscoveryAttrPeer is the globally unique identifier of the advertised syncbase.

View Source
const DiscoveryAttrSyncgroupBlessing = "sb"

DiscoveryAttrSyncgroupBlessing is the blessing of the creator of the syncgroup.

View Source
const DiscoveryAttrSyncgroupName = "s"

DiscoveryAttrSyncgroupName is the name of the advertised syncgroup.

View Source
const NullBlobRef = BlobRef("")

Variables

View Source
var (
	ErrNotInDevMode             = verror.Register("v.io/v23/services/syncbase.NotInDevMode", verror.NoRetry, "{1:}{2:} not running with --dev=true")
	ErrInvalidName              = verror.Register("v.io/v23/services/syncbase.InvalidName", verror.NoRetry, "{1:}{2:} invalid name: '{3}'{:_}")
	ErrCorruptDatabase          = verror.Register("v.io/v23/services/syncbase.CorruptDatabase", verror.NoRetry, "{1:}{2:} database corrupt, moved to '{3}'; client must create a new database")
	ErrUnknownBatch             = verror.Register("v.io/v23/services/syncbase.UnknownBatch", verror.NoRetry, "{1:}{2:} unknown batch, perhaps the server restarted")
	ErrNotBoundToBatch          = verror.Register("v.io/v23/services/syncbase.NotBoundToBatch", verror.NoRetry, "{1:}{2:} not bound to batch")
	ErrReadOnlyBatch            = verror.Register("v.io/v23/services/syncbase.ReadOnlyBatch", verror.NoRetry, "{1:}{2:} batch is read-only")
	ErrConcurrentBatch          = verror.Register("v.io/v23/services/syncbase.ConcurrentBatch", verror.NoRetry, "{1:}{2:} concurrent batch")
	ErrBlobNotCommitted         = verror.Register("v.io/v23/services/syncbase.BlobNotCommitted", verror.NoRetry, "{1:}{2:} blob is not yet committed")
	ErrSyncgroupJoinFailed      = verror.Register("v.io/v23/services/syncbase.SyncgroupJoinFailed", verror.NoRetry, "{1:}{2:} syncgroup join failed{:_}")
	ErrBadExecStreamHeader      = verror.Register("v.io/v23/services/syncbase.BadExecStreamHeader", verror.NoRetry, "{1:}{2:} Exec stream header improperly formatted")
	ErrInvalidPermissionsChange = verror.Register("v.io/v23/services/syncbase.InvalidPermissionsChange", verror.NoRetry, "{1:}{2:} the sequence of permission changes is invalid")
	ErrUnauthorizedCreateId     = verror.Register("v.io/v23/services/syncbase.UnauthorizedCreateId", verror.NoRetry, "{1:}{2:} not authorized to create object with id blessing '{3}' (name '{4}'){:_}")
	ErrInferAppBlessingFailed   = verror.Register("v.io/v23/services/syncbase.InferAppBlessingFailed", verror.NoRetry, "{1:}{2:} failed to infer app blessing pattern for {3} '{4}'{:_}")
	ErrInferUserBlessingFailed  = verror.Register("v.io/v23/services/syncbase.InferUserBlessingFailed", verror.NoRetry, "{1:}{2:} failed to infer user blessing pattern for {3} '{4}'{:_}")
	ErrInferDefaultPermsFailed  = verror.Register("v.io/v23/services/syncbase.InferDefaultPermsFailed", verror.NoRetry, "{1:}{2:} failed to infer default perms for user for {3} '{4}'{:_}")
)
View Source
var AllCollectionTags = []access.Tag{
	"Admin",
	"Read",
	"Write",
}

Access tags used in Syncbase collection ACLs.

View Source
var AllDatabaseTags = []access.Tag{
	"Admin",
	"Read",
	"Write",
	"Resolve",
}

Access tags used in Syncbase database ACLs.

View Source
var AllSyncgroupTags = []access.Tag{
	"Admin",
	"Read",
}

Access tags used in Syncbase syncgroup ACLs.

BatchSourceAll holds all labels for BatchSource.

BlobFetchStateAll holds all labels for BlobFetchState.

View Source
var BlobManagerDesc rpc.InterfaceDesc = descBlobManager

BlobManagerDesc describes the BlobManager interface.

View Source
var CollectionDesc rpc.InterfaceDesc = descCollection

CollectionDesc describes the Collection interface.

View Source
var ConflictManagerDesc rpc.InterfaceDesc = descConflictManager

ConflictManagerDesc describes the ConflictManager interface.

View Source
var DatabaseDesc rpc.InterfaceDesc = descDatabase

DatabaseDesc describes the Database interface.

View Source
var DatabaseWatcherDesc rpc.InterfaceDesc = descDatabaseWatcher

DatabaseWatcherDesc describes the DatabaseWatcher interface.

ResolverTypeAll holds all labels for ResolverType.

View Source
var RowDesc rpc.InterfaceDesc = descRow

RowDesc describes the Row interface.

View Source
var SchemaManagerDesc rpc.InterfaceDesc = descSchemaManager

SchemaManagerDesc describes the SchemaManager interface.

View Source
var ServiceDesc rpc.InterfaceDesc = descService

ServiceDesc describes the Service interface.

View Source
var SyncgroupManagerDesc rpc.InterfaceDesc = descSyncgroupManager

SyncgroupManagerDesc describes the SyncgroupManager interface.

ValueSelectionAll holds all labels for ValueSelection.

ValueStateAll holds all labels for ValueState.

Functions

func NewErrBadExecStreamHeader

func NewErrBadExecStreamHeader(ctx *context.T) error

NewErrBadExecStreamHeader returns an error with the ErrBadExecStreamHeader ID.

func NewErrBlobNotCommitted

func NewErrBlobNotCommitted(ctx *context.T) error

NewErrBlobNotCommitted returns an error with the ErrBlobNotCommitted ID.

func NewErrConcurrentBatch

func NewErrConcurrentBatch(ctx *context.T) error

NewErrConcurrentBatch returns an error with the ErrConcurrentBatch ID.

func NewErrCorruptDatabase

func NewErrCorruptDatabase(ctx *context.T, path string) error

NewErrCorruptDatabase returns an error with the ErrCorruptDatabase ID.

func NewErrInferAppBlessingFailed

func NewErrInferAppBlessingFailed(ctx *context.T, entity string, name string) error

NewErrInferAppBlessingFailed returns an error with the ErrInferAppBlessingFailed ID.

func NewErrInferDefaultPermsFailed

func NewErrInferDefaultPermsFailed(ctx *context.T, entity string, id string) error

NewErrInferDefaultPermsFailed returns an error with the ErrInferDefaultPermsFailed ID.

func NewErrInferUserBlessingFailed

func NewErrInferUserBlessingFailed(ctx *context.T, entity string, name string) error

NewErrInferUserBlessingFailed returns an error with the ErrInferUserBlessingFailed ID.

func NewErrInvalidName

func NewErrInvalidName(ctx *context.T, name string) error

NewErrInvalidName returns an error with the ErrInvalidName ID.

func NewErrInvalidPermissionsChange

func NewErrInvalidPermissionsChange(ctx *context.T) error

NewErrInvalidPermissionsChange returns an error with the ErrInvalidPermissionsChange ID.

func NewErrNotBoundToBatch

func NewErrNotBoundToBatch(ctx *context.T) error

NewErrNotBoundToBatch returns an error with the ErrNotBoundToBatch ID.

func NewErrNotInDevMode

func NewErrNotInDevMode(ctx *context.T) error

NewErrNotInDevMode returns an error with the ErrNotInDevMode ID.

func NewErrReadOnlyBatch

func NewErrReadOnlyBatch(ctx *context.T) error

NewErrReadOnlyBatch returns an error with the ErrReadOnlyBatch ID.

func NewErrSyncgroupJoinFailed

func NewErrSyncgroupJoinFailed(ctx *context.T) error

NewErrSyncgroupJoinFailed returns an error with the ErrSyncgroupJoinFailed ID.

func NewErrUnauthorizedCreateId

func NewErrUnauthorizedCreateId(ctx *context.T, blessing string, name string) error

NewErrUnauthorizedCreateId returns an error with the ErrUnauthorizedCreateId ID.

func NewErrUnknownBatch

func NewErrUnknownBatch(ctx *context.T) error

NewErrUnknownBatch returns an error with the ErrUnknownBatch ID.

func VDLReadConflictData

func VDLReadConflictData(dec vdl.Decoder, x *ConflictData) error

func VDLReadOperation

func VDLReadOperation(dec vdl.Decoder, x *Operation) error

Types

type BatchHandle

type BatchHandle string

BatchHandle is a reference to a batch.

func (BatchHandle) VDLIsZero

func (x BatchHandle) VDLIsZero() bool

func (*BatchHandle) VDLRead

func (x *BatchHandle) VDLRead(dec vdl.Decoder) error

func (BatchHandle) VDLReflect

func (BatchHandle) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.BatchHandle"`
})

func (BatchHandle) VDLWrite

func (x BatchHandle) VDLWrite(enc vdl.Encoder) error

type BatchInfo

type BatchInfo struct {
	// Id is an identifier for a batch contained in a conflict. It is
	// unique only in the context of a given conflict. Its purpose is solely to
	// group one or more RowInfo objects together to represent a batch that
	// was committed by the client.
	Id uint64
	// Hint is the hint provided by the client when this batch was committed.
	Hint string
	// Source states where the batch comes from.
	Source BatchSource
}

func (BatchInfo) VDLIsZero

func (x BatchInfo) VDLIsZero() bool

func (*BatchInfo) VDLRead

func (x *BatchInfo) VDLRead(dec vdl.Decoder) error

func (BatchInfo) VDLReflect

func (BatchInfo) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.BatchInfo"`
})

func (BatchInfo) VDLWrite

func (x BatchInfo) VDLWrite(enc vdl.Encoder) error

type BatchOptions

type BatchOptions struct {
	// Arbitrary string, typically used to describe the intent behind a batch.
	// Hints are surfaced to clients during conflict resolution.
	// TODO(sadovsky): Use "any" here?
	Hint string
	// ReadOnly specifies whether the batch should allow writes.
	// If ReadOnly is set to true, Abort() should be used to release any resources
	// associated with this batch (though it is not strictly required), and
	// Commit() will always fail.
	ReadOnly bool
}

BatchOptions configures a batch. TODO(sadovsky): Add more options, e.g. to configure isolation, timeouts, whether to track the read set and/or write set, etc. TODO(sadovsky): Maybe add a DefaultBatchOptions() function that initializes BatchOptions with our desired defaults. Clients would be encouraged to initialize their BatchOptions object using that function and then modify it to their liking.

func (BatchOptions) VDLIsZero

func (x BatchOptions) VDLIsZero() bool

func (*BatchOptions) VDLRead

func (x *BatchOptions) VDLRead(dec vdl.Decoder) error

func (BatchOptions) VDLReflect

func (BatchOptions) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.BatchOptions"`
})

func (BatchOptions) VDLWrite

func (x BatchOptions) VDLWrite(enc vdl.Encoder) error

type BatchSource

type BatchSource int

BatchSource represents where the batch was committed.

const (
	BatchSourceLocal BatchSource = iota
	BatchSourceRemote
)

func BatchSourceFromString

func BatchSourceFromString(label string) (x BatchSource, err error)

BatchSourceFromString creates a BatchSource from a string label.

func (*BatchSource) Set

func (x *BatchSource) Set(label string) error

Set assigns label to x.

func (BatchSource) String

func (x BatchSource) String() string

String returns the string label of x.

func (BatchSource) VDLIsZero

func (x BatchSource) VDLIsZero() bool

func (*BatchSource) VDLRead

func (x *BatchSource) VDLRead(dec vdl.Decoder) error

func (BatchSource) VDLReflect

func (BatchSource) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.BatchSource"`
	Enum struct{ Local, Remote string }
})

func (BatchSource) VDLWrite

func (x BatchSource) VDLWrite(enc vdl.Encoder) error

type BlobFetchState

type BlobFetchState int

BlobFetchState represents the state transitions of a blob fetch.

const (
	BlobFetchStatePending BlobFetchState = iota
	BlobFetchStateLocating
	BlobFetchStateFetching
	BlobFetchStateDone
)

func BlobFetchStateFromString

func BlobFetchStateFromString(label string) (x BlobFetchState, err error)

BlobFetchStateFromString creates a BlobFetchState from a string label.

func (*BlobFetchState) Set

func (x *BlobFetchState) Set(label string) error

Set assigns label to x.

func (BlobFetchState) String

func (x BlobFetchState) String() string

String returns the string label of x.

func (BlobFetchState) VDLIsZero

func (x BlobFetchState) VDLIsZero() bool

func (*BlobFetchState) VDLRead

func (x *BlobFetchState) VDLRead(dec vdl.Decoder) error

func (BlobFetchState) VDLReflect

func (BlobFetchState) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.BlobFetchState"`
	Enum struct{ Pending, Locating, Fetching, Done string }
})

func (BlobFetchState) VDLWrite

func (x BlobFetchState) VDLWrite(enc vdl.Encoder) error

type BlobFetchStatus

type BlobFetchStatus struct {
	State    BlobFetchState // State of the blob fetch request.
	Received int64          // Total number of bytes received.
	Total    int64          // Blob size.
}

BlobFetchStatus describes the progress of an asynchronous blob fetch.

func (BlobFetchStatus) VDLIsZero

func (x BlobFetchStatus) VDLIsZero() bool

func (*BlobFetchStatus) VDLRead

func (x *BlobFetchStatus) VDLRead(dec vdl.Decoder) error

func (BlobFetchStatus) VDLReflect

func (BlobFetchStatus) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.BlobFetchStatus"`
})

func (BlobFetchStatus) VDLWrite

func (x BlobFetchStatus) VDLWrite(enc vdl.Encoder) error

type BlobManagerClientMethods

type BlobManagerClientMethods interface {
	// CreateBlob returns a BlobRef for a newly created blob.
	//
	// Requires: Write on Database.
	CreateBlob(*context.T, ...rpc.CallOpt) (br BlobRef, _ error)
	// PutBlob appends the byte stream to the blob.
	//
	// Requires: Write on Database and valid BlobRef.
	PutBlob(_ *context.T, br BlobRef, _ ...rpc.CallOpt) (BlobManagerPutBlobClientCall, error)
	// CommitBlob marks the blob as immutable.
	//
	// Requires: Write on Database and valid BlobRef.
	CommitBlob(_ *context.T, br BlobRef, _ ...rpc.CallOpt) error
	// GetBlobSize returns the count of bytes written as part of the blob
	// (committed or uncommitted).
	//
	// Requires: at least one tag on Database and valid BlobRef.
	GetBlobSize(_ *context.T, br BlobRef, _ ...rpc.CallOpt) (int64, error)
	// DeleteBlob locally deletes the blob (committed or uncommitted).
	//
	// Requires: at least one tag on Database and valid BlobRef.
	DeleteBlob(_ *context.T, br BlobRef, _ ...rpc.CallOpt) error
	// GetBlob returns the byte stream from a committed blob starting at offset.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	GetBlob(_ *context.T, br BlobRef, offset int64, _ ...rpc.CallOpt) (BlobManagerGetBlobClientCall, error)
	// FetchBlob initiates fetching a blob if not locally found. priority
	// controls the network priority of the blob. Higher priority blobs are
	// fetched before the lower priority ones. However, an ongoing blob
	// transfer is not interrupted. Status updates are streamed back to the
	// client as fetch is in progress.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	FetchBlob(_ *context.T, br BlobRef, priority uint64, _ ...rpc.CallOpt) (BlobManagerFetchBlobClientCall, error)
	// PinBlob locally pins the blob so that it is not evicted.
	//
	// Requires: Write on Database and valid BlobRef.
	PinBlob(_ *context.T, br BlobRef, _ ...rpc.CallOpt) error
	// UnpinBlob locally unpins the blob so that it can be evicted if needed.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	UnpinBlob(_ *context.T, br BlobRef, _ ...rpc.CallOpt) error
	// KeepBlob locally caches the blob with the specified rank. Lower
	// ranked blobs are more eagerly evicted.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	KeepBlob(_ *context.T, br BlobRef, rank uint64, _ ...rpc.CallOpt) error
}

BlobManagerClientMethods is the client interface containing BlobManager methods.

BlobManager is the interface for blob operations.

Description of API for resumable blob creation (append-only):

  • Up until commit, a BlobRef may be used with PutBlob, GetBlobSize, DeleteBlob, and CommitBlob. Blob creation may be resumed by obtaining the current blob size via GetBlobSize and appending to the blob via PutBlob.
  • After commit, a blob is immutable, at which point PutBlob and CommitBlob may no longer be used.
  • All other methods (GetBlob, FetchBlob, PinBlob, etc.) may only be used after commit.

type BlobManagerClientStub

type BlobManagerClientStub interface {
	BlobManagerClientMethods
	rpc.UniversalServiceMethods
}

BlobManagerClientStub adds universal methods to BlobManagerClientMethods.

func BlobManagerClient

func BlobManagerClient(name string) BlobManagerClientStub

BlobManagerClient returns a client stub for BlobManager.

type BlobManagerFetchBlobClientCall

type BlobManagerFetchBlobClientCall interface {
	BlobManagerFetchBlobClientStream
	// Finish blocks until the server is done, and returns the positional return
	// values for call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

BlobManagerFetchBlobClientCall represents the call returned from BlobManager.FetchBlob.

type BlobManagerFetchBlobClientStream

type BlobManagerFetchBlobClientStream interface {
	// RecvStream returns the receiver side of the BlobManager.FetchBlob client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() BlobFetchStatus
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

BlobManagerFetchBlobClientStream is the client stream for BlobManager.FetchBlob.

type BlobManagerFetchBlobServerCall

type BlobManagerFetchBlobServerCall interface {
	rpc.ServerCall
	BlobManagerFetchBlobServerStream
}

BlobManagerFetchBlobServerCall represents the context passed to BlobManager.FetchBlob.

type BlobManagerFetchBlobServerCallStub

type BlobManagerFetchBlobServerCallStub struct {
	rpc.StreamServerCall
}

BlobManagerFetchBlobServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements BlobManagerFetchBlobServerCall.

func (*BlobManagerFetchBlobServerCallStub) Init

Init initializes BlobManagerFetchBlobServerCallStub from rpc.StreamServerCall.

func (*BlobManagerFetchBlobServerCallStub) SendStream

func (s *BlobManagerFetchBlobServerCallStub) SendStream() interface {
	Send(item BlobFetchStatus) error
}

SendStream returns the send side of the BlobManager.FetchBlob server stream.

type BlobManagerFetchBlobServerStream

type BlobManagerFetchBlobServerStream interface {
	// SendStream returns the send side of the BlobManager.FetchBlob server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item BlobFetchStatus) error
	}
}

BlobManagerFetchBlobServerStream is the server stream for BlobManager.FetchBlob.

type BlobManagerGetBlobClientCall

type BlobManagerGetBlobClientCall interface {
	BlobManagerGetBlobClientStream
	// Finish blocks until the server is done, and returns the positional return
	// values for call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

BlobManagerGetBlobClientCall represents the call returned from BlobManager.GetBlob.

type BlobManagerGetBlobClientStream

type BlobManagerGetBlobClientStream interface {
	// RecvStream returns the receiver side of the BlobManager.GetBlob client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() []byte
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

BlobManagerGetBlobClientStream is the client stream for BlobManager.GetBlob.

type BlobManagerGetBlobServerCall

type BlobManagerGetBlobServerCall interface {
	rpc.ServerCall
	BlobManagerGetBlobServerStream
}

BlobManagerGetBlobServerCall represents the context passed to BlobManager.GetBlob.

type BlobManagerGetBlobServerCallStub

type BlobManagerGetBlobServerCallStub struct {
	rpc.StreamServerCall
}

BlobManagerGetBlobServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements BlobManagerGetBlobServerCall.

func (*BlobManagerGetBlobServerCallStub) Init

Init initializes BlobManagerGetBlobServerCallStub from rpc.StreamServerCall.

func (*BlobManagerGetBlobServerCallStub) SendStream

func (s *BlobManagerGetBlobServerCallStub) SendStream() interface {
	Send(item []byte) error
}

SendStream returns the send side of the BlobManager.GetBlob server stream.

type BlobManagerGetBlobServerStream

type BlobManagerGetBlobServerStream interface {
	// SendStream returns the send side of the BlobManager.GetBlob server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item []byte) error
	}
}

BlobManagerGetBlobServerStream is the server stream for BlobManager.GetBlob.

type BlobManagerPutBlobClientCall

type BlobManagerPutBlobClientCall interface {
	BlobManagerPutBlobClientStream
	// Finish performs the equivalent of SendStream().Close, then blocks until
	// the server is done, and returns the positional return values for the call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

BlobManagerPutBlobClientCall represents the call returned from BlobManager.PutBlob.

type BlobManagerPutBlobClientStream

type BlobManagerPutBlobClientStream interface {
	// SendStream returns the send side of the BlobManager.PutBlob client stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors
		// encountered while sending, or if Send is called after Close or
		// the stream has been canceled.  Blocks if there is no buffer
		// space; will unblock when buffer space is available or after
		// the stream has been canceled.
		Send(item []byte) error
		// Close indicates to the server that no more items will be sent;
		// server Recv calls will receive io.EOF after all sent items.
		// This is an optional call - e.g. a client might call Close if it
		// needs to continue receiving items from the server after it's
		// done sending.  Returns errors encountered while closing, or if
		// Close is called after the stream has been canceled.  Like Send,
		// blocks if there is no buffer space available.
		Close() error
	}
}

BlobManagerPutBlobClientStream is the client stream for BlobManager.PutBlob.

type BlobManagerPutBlobServerCall

type BlobManagerPutBlobServerCall interface {
	rpc.ServerCall
	BlobManagerPutBlobServerStream
}

BlobManagerPutBlobServerCall represents the context passed to BlobManager.PutBlob.

type BlobManagerPutBlobServerCallStub

type BlobManagerPutBlobServerCallStub struct {
	rpc.StreamServerCall
	// contains filtered or unexported fields
}

BlobManagerPutBlobServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements BlobManagerPutBlobServerCall.

func (*BlobManagerPutBlobServerCallStub) Init

Init initializes BlobManagerPutBlobServerCallStub from rpc.StreamServerCall.

func (*BlobManagerPutBlobServerCallStub) RecvStream

func (s *BlobManagerPutBlobServerCallStub) RecvStream() interface {
	Advance() bool
	Value() []byte
	Err() error
}

RecvStream returns the receiver side of the BlobManager.PutBlob server stream.

type BlobManagerPutBlobServerStream

type BlobManagerPutBlobServerStream interface {
	// RecvStream returns the receiver side of the BlobManager.PutBlob server stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() []byte
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

BlobManagerPutBlobServerStream is the server stream for BlobManager.PutBlob.

type BlobManagerServerMethods

type BlobManagerServerMethods interface {
	// CreateBlob returns a BlobRef for a newly created blob.
	//
	// Requires: Write on Database.
	CreateBlob(*context.T, rpc.ServerCall) (br BlobRef, _ error)
	// PutBlob appends the byte stream to the blob.
	//
	// Requires: Write on Database and valid BlobRef.
	PutBlob(_ *context.T, _ BlobManagerPutBlobServerCall, br BlobRef) error
	// CommitBlob marks the blob as immutable.
	//
	// Requires: Write on Database and valid BlobRef.
	CommitBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// GetBlobSize returns the count of bytes written as part of the blob
	// (committed or uncommitted).
	//
	// Requires: at least one tag on Database and valid BlobRef.
	GetBlobSize(_ *context.T, _ rpc.ServerCall, br BlobRef) (int64, error)
	// DeleteBlob locally deletes the blob (committed or uncommitted).
	//
	// Requires: at least one tag on Database and valid BlobRef.
	DeleteBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// GetBlob returns the byte stream from a committed blob starting at offset.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	GetBlob(_ *context.T, _ BlobManagerGetBlobServerCall, br BlobRef, offset int64) error
	// FetchBlob initiates fetching a blob if not locally found. priority
	// controls the network priority of the blob. Higher priority blobs are
	// fetched before the lower priority ones. However, an ongoing blob
	// transfer is not interrupted. Status updates are streamed back to the
	// client as fetch is in progress.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	FetchBlob(_ *context.T, _ BlobManagerFetchBlobServerCall, br BlobRef, priority uint64) error
	// PinBlob locally pins the blob so that it is not evicted.
	//
	// Requires: Write on Database and valid BlobRef.
	PinBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// UnpinBlob locally unpins the blob so that it can be evicted if needed.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	UnpinBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// KeepBlob locally caches the blob with the specified rank. Lower
	// ranked blobs are more eagerly evicted.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	KeepBlob(_ *context.T, _ rpc.ServerCall, br BlobRef, rank uint64) error
}

BlobManagerServerMethods is the interface a server writer implements for BlobManager.

BlobManager is the interface for blob operations.

Description of API for resumable blob creation (append-only):

  • Up until commit, a BlobRef may be used with PutBlob, GetBlobSize, DeleteBlob, and CommitBlob. Blob creation may be resumed by obtaining the current blob size via GetBlobSize and appending to the blob via PutBlob.
  • After commit, a blob is immutable, at which point PutBlob and CommitBlob may no longer be used.
  • All other methods (GetBlob, FetchBlob, PinBlob, etc.) may only be used after commit.

type BlobManagerServerStub

type BlobManagerServerStub interface {
	BlobManagerServerStubMethods
	// Describe the BlobManager interfaces.
	Describe__() []rpc.InterfaceDesc
}

BlobManagerServerStub adds universal methods to BlobManagerServerStubMethods.

func BlobManagerServer

func BlobManagerServer(impl BlobManagerServerMethods) BlobManagerServerStub

BlobManagerServer returns a server stub for BlobManager. It converts an implementation of BlobManagerServerMethods into an object that may be used by rpc.Server.

type BlobManagerServerStubMethods

type BlobManagerServerStubMethods interface {
	// CreateBlob returns a BlobRef for a newly created blob.
	//
	// Requires: Write on Database.
	CreateBlob(*context.T, rpc.ServerCall) (br BlobRef, _ error)
	// PutBlob appends the byte stream to the blob.
	//
	// Requires: Write on Database and valid BlobRef.
	PutBlob(_ *context.T, _ *BlobManagerPutBlobServerCallStub, br BlobRef) error
	// CommitBlob marks the blob as immutable.
	//
	// Requires: Write on Database and valid BlobRef.
	CommitBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// GetBlobSize returns the count of bytes written as part of the blob
	// (committed or uncommitted).
	//
	// Requires: at least one tag on Database and valid BlobRef.
	GetBlobSize(_ *context.T, _ rpc.ServerCall, br BlobRef) (int64, error)
	// DeleteBlob locally deletes the blob (committed or uncommitted).
	//
	// Requires: at least one tag on Database and valid BlobRef.
	DeleteBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// GetBlob returns the byte stream from a committed blob starting at offset.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	GetBlob(_ *context.T, _ *BlobManagerGetBlobServerCallStub, br BlobRef, offset int64) error
	// FetchBlob initiates fetching a blob if not locally found. priority
	// controls the network priority of the blob. Higher priority blobs are
	// fetched before the lower priority ones. However, an ongoing blob
	// transfer is not interrupted. Status updates are streamed back to the
	// client as fetch is in progress.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	FetchBlob(_ *context.T, _ *BlobManagerFetchBlobServerCallStub, br BlobRef, priority uint64) error
	// PinBlob locally pins the blob so that it is not evicted.
	//
	// Requires: Write on Database and valid BlobRef.
	PinBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// UnpinBlob locally unpins the blob so that it can be evicted if needed.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	UnpinBlob(_ *context.T, _ rpc.ServerCall, br BlobRef) error
	// KeepBlob locally caches the blob with the specified rank. Lower
	// ranked blobs are more eagerly evicted.
	//
	// Requires: at least one tag on Database and valid BlobRef.
	KeepBlob(_ *context.T, _ rpc.ServerCall, br BlobRef, rank uint64) error
}

BlobManagerServerStubMethods is the server interface containing BlobManager methods, as expected by rpc.Server. The only difference between this interface and BlobManagerServerMethods is the streaming methods.

type BlobRef

type BlobRef string

BlobRef is a reference to a blob.

func (BlobRef) VDLIsZero

func (x BlobRef) VDLIsZero() bool

func (*BlobRef) VDLRead

func (x *BlobRef) VDLRead(dec vdl.Decoder) error

func (BlobRef) VDLReflect

func (BlobRef) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.BlobRef"`
})

func (BlobRef) VDLWrite

func (x BlobRef) VDLWrite(enc vdl.Encoder) error

type CollectionClientMethods

type CollectionClientMethods interface {
	// Create creates this Collection. Permissions must be non-nil and include at
	// least one admin.
	//
	// Requires: Write on Database.
	// Also requires the creator's blessing to match the pattern in the newly
	// created Collection's id.
	Create(_ *context.T, bh BatchHandle, perms access.Permissions, _ ...rpc.CallOpt) error
	// Destroy destroys this Collection, permanently removing all of its data.
	//
	// Requires: Admin on Collection or on Database.
	// TODO(ivanpi): Prevent for synced Collections.
	Destroy(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) error
	// Exists returns true only if this Collection exists.
	//
	// Requires: at least one tag on Collection, or Read or Write on Database.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	// If Database does not exist, returned value is identical to
	// Database.Exists().
	Exists(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) (bool, error)
	// GetPermissions returns the current Permissions for the Collection.
	//
	// Requires: Admin on Collection.
	GetPermissions(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) (access.Permissions, error)
	// SetPermissions replaces the current Permissions for the Collection.
	// Permissions must include at least one admin.
	//
	// Requires: Admin on Collection.
	SetPermissions(_ *context.T, bh BatchHandle, perms access.Permissions, _ ...rpc.CallOpt) error
	// DeleteRange deletes all rows in the given half-open range [start, limit).
	// If limit is "", all rows with keys >= start are included.
	//
	// Requires: Write on Collection.
	DeleteRange(_ *context.T, bh BatchHandle, start []byte, limit []byte, _ ...rpc.CallOpt) error
	// Scan returns all rows in the given half-open range [start, limit). If limit
	// is "", all rows with keys >= start are included.
	// Concurrency semantics are documented in model.go.
	// Note, we use []byte rather than string for start and limit because they
	// need not be valid UTF-8; VDL expects strings to be valid UTF-8.
	//
	// Requires: Read on Collection.
	Scan(_ *context.T, bh BatchHandle, start []byte, limit []byte, _ ...rpc.CallOpt) (CollectionScanClientCall, error)
}

CollectionClientMethods is the client interface containing Collection methods.

Collection represents a set of Rows. Collection.Glob operates over keys of Rows in the Collection, requiring Read on Collection, returning keys in a lexicographically sorted order.

type CollectionClientStub

type CollectionClientStub interface {
	CollectionClientMethods
	rpc.UniversalServiceMethods
}

CollectionClientStub adds universal methods to CollectionClientMethods.

func CollectionClient

func CollectionClient(name string) CollectionClientStub

CollectionClient returns a client stub for Collection.

type CollectionRowPattern

type CollectionRowPattern struct {
	CollectionBlessing string
	CollectionName     string
	RowKey             string
}

CollectionRowPattern contains SQL LIKE-style glob patterns ('%' and '_' wildcards, '\' as escape character) for matching rows and collections by name components. Collection blessing and name patterns are not allowed to be empty, but the row key pattern is (for matching only collections and no rows).

func (CollectionRowPattern) VDLIsZero

func (x CollectionRowPattern) VDLIsZero() bool

func (*CollectionRowPattern) VDLRead

func (x *CollectionRowPattern) VDLRead(dec vdl.Decoder) error

func (CollectionRowPattern) VDLReflect

func (CollectionRowPattern) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.CollectionRowPattern"`
})

func (CollectionRowPattern) VDLWrite

func (x CollectionRowPattern) VDLWrite(enc vdl.Encoder) error

type CollectionScanClientCall

type CollectionScanClientCall interface {
	CollectionScanClientStream
	// Finish blocks until the server is done, and returns the positional return
	// values for call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

CollectionScanClientCall represents the call returned from Collection.Scan.

type CollectionScanClientStream

type CollectionScanClientStream interface {
	// RecvStream returns the receiver side of the Collection.Scan client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() KeyValue
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

CollectionScanClientStream is the client stream for Collection.Scan.

type CollectionScanServerCall

type CollectionScanServerCall interface {
	rpc.ServerCall
	CollectionScanServerStream
}

CollectionScanServerCall represents the context passed to Collection.Scan.

type CollectionScanServerCallStub

type CollectionScanServerCallStub struct {
	rpc.StreamServerCall
}

CollectionScanServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements CollectionScanServerCall.

func (*CollectionScanServerCallStub) Init

Init initializes CollectionScanServerCallStub from rpc.StreamServerCall.

func (*CollectionScanServerCallStub) SendStream

func (s *CollectionScanServerCallStub) SendStream() interface {
	Send(item KeyValue) error
}

SendStream returns the send side of the Collection.Scan server stream.

type CollectionScanServerStream

type CollectionScanServerStream interface {
	// SendStream returns the send side of the Collection.Scan server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item KeyValue) error
	}
}

CollectionScanServerStream is the server stream for Collection.Scan.

type CollectionServerMethods

type CollectionServerMethods interface {
	// Create creates this Collection. Permissions must be non-nil and include at
	// least one admin.
	//
	// Requires: Write on Database.
	// Also requires the creator's blessing to match the pattern in the newly
	// created Collection's id.
	Create(_ *context.T, _ rpc.ServerCall, bh BatchHandle, perms access.Permissions) error
	// Destroy destroys this Collection, permanently removing all of its data.
	//
	// Requires: Admin on Collection or on Database.
	// TODO(ivanpi): Prevent for synced Collections.
	Destroy(_ *context.T, _ rpc.ServerCall, bh BatchHandle) error
	// Exists returns true only if this Collection exists.
	//
	// Requires: at least one tag on Collection, or Read or Write on Database.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	// If Database does not exist, returned value is identical to
	// Database.Exists().
	Exists(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (bool, error)
	// GetPermissions returns the current Permissions for the Collection.
	//
	// Requires: Admin on Collection.
	GetPermissions(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (access.Permissions, error)
	// SetPermissions replaces the current Permissions for the Collection.
	// Permissions must include at least one admin.
	//
	// Requires: Admin on Collection.
	SetPermissions(_ *context.T, _ rpc.ServerCall, bh BatchHandle, perms access.Permissions) error
	// DeleteRange deletes all rows in the given half-open range [start, limit).
	// If limit is "", all rows with keys >= start are included.
	//
	// Requires: Write on Collection.
	DeleteRange(_ *context.T, _ rpc.ServerCall, bh BatchHandle, start []byte, limit []byte) error
	// Scan returns all rows in the given half-open range [start, limit). If limit
	// is "", all rows with keys >= start are included.
	// Concurrency semantics are documented in model.go.
	// Note, we use []byte rather than string for start and limit because they
	// need not be valid UTF-8; VDL expects strings to be valid UTF-8.
	//
	// Requires: Read on Collection.
	Scan(_ *context.T, _ CollectionScanServerCall, bh BatchHandle, start []byte, limit []byte) error
}

CollectionServerMethods is the interface a server writer implements for Collection.

Collection represents a set of Rows. Collection.Glob operates over keys of Rows in the Collection, requiring Read on Collection, returning keys in a lexicographically sorted order.

type CollectionServerStub

type CollectionServerStub interface {
	CollectionServerStubMethods
	// Describe the Collection interfaces.
	Describe__() []rpc.InterfaceDesc
}

CollectionServerStub adds universal methods to CollectionServerStubMethods.

func CollectionServer

func CollectionServer(impl CollectionServerMethods) CollectionServerStub

CollectionServer returns a server stub for Collection. It converts an implementation of CollectionServerMethods into an object that may be used by rpc.Server.

type CollectionServerStubMethods

type CollectionServerStubMethods interface {
	// Create creates this Collection. Permissions must be non-nil and include at
	// least one admin.
	//
	// Requires: Write on Database.
	// Also requires the creator's blessing to match the pattern in the newly
	// created Collection's id.
	Create(_ *context.T, _ rpc.ServerCall, bh BatchHandle, perms access.Permissions) error
	// Destroy destroys this Collection, permanently removing all of its data.
	//
	// Requires: Admin on Collection or on Database.
	// TODO(ivanpi): Prevent for synced Collections.
	Destroy(_ *context.T, _ rpc.ServerCall, bh BatchHandle) error
	// Exists returns true only if this Collection exists.
	//
	// Requires: at least one tag on Collection, or Read or Write on Database.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	// If Database does not exist, returned value is identical to
	// Database.Exists().
	Exists(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (bool, error)
	// GetPermissions returns the current Permissions for the Collection.
	//
	// Requires: Admin on Collection.
	GetPermissions(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (access.Permissions, error)
	// SetPermissions replaces the current Permissions for the Collection.
	// Permissions must include at least one admin.
	//
	// Requires: Admin on Collection.
	SetPermissions(_ *context.T, _ rpc.ServerCall, bh BatchHandle, perms access.Permissions) error
	// DeleteRange deletes all rows in the given half-open range [start, limit).
	// If limit is "", all rows with keys >= start are included.
	//
	// Requires: Write on Collection.
	DeleteRange(_ *context.T, _ rpc.ServerCall, bh BatchHandle, start []byte, limit []byte) error
	// Scan returns all rows in the given half-open range [start, limit). If limit
	// is "", all rows with keys >= start are included.
	// Concurrency semantics are documented in model.go.
	// Note, we use []byte rather than string for start and limit because they
	// need not be valid UTF-8; VDL expects strings to be valid UTF-8.
	//
	// Requires: Read on Collection.
	Scan(_ *context.T, _ *CollectionScanServerCallStub, bh BatchHandle, start []byte, limit []byte) error
}

CollectionServerStubMethods is the server interface containing Collection methods, as expected by rpc.Server. The only difference between this interface and CollectionServerMethods is the streaming methods.

type ConflictData

type ConflictData interface {
	// Index returns the field index.
	Index() int
	// Interface returns the field value as an interface.
	Interface() interface{}
	// Name returns the field name.
	Name() string
	// VDLReflect describes the ConflictData union type.
	VDLReflect(__ConflictDataReflect)
	VDLIsZero() bool
	VDLWrite(vdl.Encoder) error
}

ConflictData represents any single field of the ConflictData union type.

ConflictData represents a unit of conflict data sent over the stream. It can either contain information about a Batch or about an operation done on a row.

type ConflictDataBatch

type ConflictDataBatch struct{ Value BatchInfo }

ConflictDataBatch represents field Batch of the ConflictData union type.

func (ConflictDataBatch) Index

func (x ConflictDataBatch) Index() int

func (ConflictDataBatch) Interface

func (x ConflictDataBatch) Interface() interface{}

func (ConflictDataBatch) Name

func (x ConflictDataBatch) Name() string

func (ConflictDataBatch) VDLIsZero

func (x ConflictDataBatch) VDLIsZero() bool

func (ConflictDataBatch) VDLReflect

func (x ConflictDataBatch) VDLReflect(__ConflictDataReflect)

func (ConflictDataBatch) VDLWrite

func (x ConflictDataBatch) VDLWrite(enc vdl.Encoder) error

type ConflictDataRow

type ConflictDataRow struct{ Value RowInfo }

ConflictDataRow represents field Row of the ConflictData union type.

func (ConflictDataRow) Index

func (x ConflictDataRow) Index() int

func (ConflictDataRow) Interface

func (x ConflictDataRow) Interface() interface{}

func (ConflictDataRow) Name

func (x ConflictDataRow) Name() string

func (ConflictDataRow) VDLIsZero

func (x ConflictDataRow) VDLIsZero() bool

func (ConflictDataRow) VDLReflect

func (x ConflictDataRow) VDLReflect(__ConflictDataReflect)

func (ConflictDataRow) VDLWrite

func (x ConflictDataRow) VDLWrite(enc vdl.Encoder) error

type ConflictInfo

type ConflictInfo struct {
	// Data is a unit chunk of ConflictInfo which can be sent over the conflict
	// stream.
	Data ConflictData
	// Continued represents whether the batch of ConflictInfos has ended.
	Continued bool
}

ConflictInfo contains information to fully specify a conflict for a key, providing the (local, remote, ancestor) tuple. A key under conflict can be a part of a batch in local, remote or both updates. Since the batches can have more than one key, all ConflictInfos for the keys within the batches are grouped together into a single conflict batch and sent as a stream with the Continued field representing conflict batch boundaries.

func (ConflictInfo) VDLIsZero

func (x ConflictInfo) VDLIsZero() bool

func (*ConflictInfo) VDLRead

func (x *ConflictInfo) VDLRead(dec vdl.Decoder) error

func (ConflictInfo) VDLReflect

func (ConflictInfo) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.ConflictInfo"`
})

func (ConflictInfo) VDLWrite

func (x ConflictInfo) VDLWrite(enc vdl.Encoder) error

type ConflictManagerClientMethods

type ConflictManagerClientMethods interface {
	// StartConflictResolver registers a resolver for the database that is
	// associated with this ConflictManager and creates a stream to receive
	// conflicts and send resolutions.
	// Batches of ConflictInfos will be sent over with the Continued field
	// within the ConflictInfo representing the batch boundary. Client must
	// respond with a batch of ResolutionInfos in the same fashion.
	// A key is under conflict if two different values were written to it
	// concurrently (in logical time), i.e. neither value is an ancestor of the
	// other in the history graph.
	// A key under conflict can be a part of a batch committed on local or
	// remote or both syncbases. ConflictInfos for all keys in these two batches
	// are grouped together. These keys may themselves be under conflict; the
	// presented batch is a transitive closure of all batches containing keys
	// under conflict.
	// For example, for local batch {key1, key2} and remote batch {key1, key3},
	// the batch sent for conflict resolution will be {key1, key2, key3}.
	// If there was another concurrent batch {key2, key4}, then the batch sent
	// for conflict resolution will be {key1, key2, key3, key4}.
	//
	// Requires: Admin on Database.
	StartConflictResolver(*context.T, ...rpc.CallOpt) (ConflictManagerStartConflictResolverClientCall, error)
}

ConflictManagerClientMethods is the client interface containing ConflictManager methods.

ConflictManager interface provides all the methods necessary to handle conflict resolution for a given database.

type ConflictManagerClientStub

type ConflictManagerClientStub interface {
	ConflictManagerClientMethods
	rpc.UniversalServiceMethods
}

ConflictManagerClientStub adds universal methods to ConflictManagerClientMethods.

func ConflictManagerClient

func ConflictManagerClient(name string) ConflictManagerClientStub

ConflictManagerClient returns a client stub for ConflictManager.

type ConflictManagerServerMethods

type ConflictManagerServerMethods interface {
	// StartConflictResolver registers a resolver for the database that is
	// associated with this ConflictManager and creates a stream to receive
	// conflicts and send resolutions.
	// Batches of ConflictInfos will be sent over with the Continued field
	// within the ConflictInfo representing the batch boundary. Client must
	// respond with a batch of ResolutionInfos in the same fashion.
	// A key is under conflict if two different values were written to it
	// concurrently (in logical time), i.e. neither value is an ancestor of the
	// other in the history graph.
	// A key under conflict can be a part of a batch committed on local or
	// remote or both syncbases. ConflictInfos for all keys in these two batches
	// are grouped together. These keys may themselves be under conflict; the
	// presented batch is a transitive closure of all batches containing keys
	// under conflict.
	// For example, for local batch {key1, key2} and remote batch {key1, key3},
	// the batch sent for conflict resolution will be {key1, key2, key3}.
	// If there was another concurrent batch {key2, key4}, then the batch sent
	// for conflict resolution will be {key1, key2, key3, key4}.
	//
	// Requires: Admin on Database.
	StartConflictResolver(*context.T, ConflictManagerStartConflictResolverServerCall) error
}

ConflictManagerServerMethods is the interface a server writer implements for ConflictManager.

ConflictManager interface provides all the methods necessary to handle conflict resolution for a given database.

type ConflictManagerServerStub

type ConflictManagerServerStub interface {
	ConflictManagerServerStubMethods
	// Describe the ConflictManager interfaces.
	Describe__() []rpc.InterfaceDesc
}

ConflictManagerServerStub adds universal methods to ConflictManagerServerStubMethods.

func ConflictManagerServer

func ConflictManagerServer(impl ConflictManagerServerMethods) ConflictManagerServerStub

ConflictManagerServer returns a server stub for ConflictManager. It converts an implementation of ConflictManagerServerMethods into an object that may be used by rpc.Server.

type ConflictManagerServerStubMethods

type ConflictManagerServerStubMethods interface {
	// StartConflictResolver registers a resolver for the database that is
	// associated with this ConflictManager and creates a stream to receive
	// conflicts and send resolutions.
	// Batches of ConflictInfos will be sent over with the Continued field
	// within the ConflictInfo representing the batch boundary. Client must
	// respond with a batch of ResolutionInfos in the same fashion.
	// A key is under conflict if two different values were written to it
	// concurrently (in logical time), i.e. neither value is an ancestor of the
	// other in the history graph.
	// A key under conflict can be a part of a batch committed on local or
	// remote or both syncbases. ConflictInfos for all keys in these two batches
	// are grouped together. These keys may themselves be under conflict; the
	// presented batch is a transitive closure of all batches containing keys
	// under conflict.
	// For example, for local batch {key1, key2} and remote batch {key1, key3},
	// the batch sent for conflict resolution will be {key1, key2, key3}.
	// If there was another concurrent batch {key2, key4}, then the batch sent
	// for conflict resolution will be {key1, key2, key3, key4}.
	//
	// Requires: Admin on Database.
	StartConflictResolver(*context.T, *ConflictManagerStartConflictResolverServerCallStub) error
}

ConflictManagerServerStubMethods is the server interface containing ConflictManager methods, as expected by rpc.Server. The only difference between this interface and ConflictManagerServerMethods is the streaming methods.

type ConflictManagerStartConflictResolverClientCall

type ConflictManagerStartConflictResolverClientCall interface {
	ConflictManagerStartConflictResolverClientStream
	// Finish performs the equivalent of SendStream().Close, then blocks until
	// the server is done, and returns the positional return values for the call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

ConflictManagerStartConflictResolverClientCall represents the call returned from ConflictManager.StartConflictResolver.

type ConflictManagerStartConflictResolverClientStream

type ConflictManagerStartConflictResolverClientStream interface {
	// RecvStream returns the receiver side of the ConflictManager.StartConflictResolver client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() ConflictInfo
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
	// SendStream returns the send side of the ConflictManager.StartConflictResolver client stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors
		// encountered while sending, or if Send is called after Close or
		// the stream has been canceled.  Blocks if there is no buffer
		// space; will unblock when buffer space is available or after
		// the stream has been canceled.
		Send(item ResolutionInfo) error
		// Close indicates to the server that no more items will be sent;
		// server Recv calls will receive io.EOF after all sent items.
		// This is an optional call - e.g. a client might call Close if it
		// needs to continue receiving items from the server after it's
		// done sending.  Returns errors encountered while closing, or if
		// Close is called after the stream has been canceled.  Like Send,
		// blocks if there is no buffer space available.
		Close() error
	}
}

ConflictManagerStartConflictResolverClientStream is the client stream for ConflictManager.StartConflictResolver.

type ConflictManagerStartConflictResolverServerCall

type ConflictManagerStartConflictResolverServerCall interface {
	rpc.ServerCall
	ConflictManagerStartConflictResolverServerStream
}

ConflictManagerStartConflictResolverServerCall represents the context passed to ConflictManager.StartConflictResolver.

type ConflictManagerStartConflictResolverServerCallStub

type ConflictManagerStartConflictResolverServerCallStub struct {
	rpc.StreamServerCall
	// contains filtered or unexported fields
}

ConflictManagerStartConflictResolverServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements ConflictManagerStartConflictResolverServerCall.

func (*ConflictManagerStartConflictResolverServerCallStub) Init

Init initializes ConflictManagerStartConflictResolverServerCallStub from rpc.StreamServerCall.

func (*ConflictManagerStartConflictResolverServerCallStub) RecvStream

func (s *ConflictManagerStartConflictResolverServerCallStub) RecvStream() interface {
	Advance() bool
	Value() ResolutionInfo
	Err() error
}

RecvStream returns the receiver side of the ConflictManager.StartConflictResolver server stream.

func (*ConflictManagerStartConflictResolverServerCallStub) SendStream

func (s *ConflictManagerStartConflictResolverServerCallStub) SendStream() interface {
	Send(item ConflictInfo) error
}

SendStream returns the send side of the ConflictManager.StartConflictResolver server stream.

type ConflictManagerStartConflictResolverServerStream

type ConflictManagerStartConflictResolverServerStream interface {
	// RecvStream returns the receiver side of the ConflictManager.StartConflictResolver server stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() ResolutionInfo
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
	// SendStream returns the send side of the ConflictManager.StartConflictResolver server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item ConflictInfo) error
	}
}

ConflictManagerStartConflictResolverServerStream is the server stream for ConflictManager.StartConflictResolver.

type CrPolicy

type CrPolicy struct {
	Rules []CrRule
}

For a given row with a conflict, all rules are matched against the row. If no rules match the row, we default to "LastWins". If multiple rules match the row, ties are broken as follows:

  1. If one match has a longer prefix than the other, take that one.
  2. Else, if only one match specifies a type, take that one.
  3. Else, the two matches are identical; take the last one in the Rules array.

func (CrPolicy) VDLIsZero

func (x CrPolicy) VDLIsZero() bool

func (*CrPolicy) VDLRead

func (x *CrPolicy) VDLRead(dec vdl.Decoder) error

func (CrPolicy) VDLReflect

func (CrPolicy) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.CrPolicy"`
})

func (CrPolicy) VDLWrite

func (x CrPolicy) VDLWrite(enc vdl.Encoder) error

type CrRule

type CrRule struct {
	// CollectionId is the id of the collection that this rule applies to.
	CollectionId Id
	// KeyPrefix represents the set of keys within the given collection for which
	// this policy applies. CollectionId must not be empty if this field is set.
	KeyPrefix string
	// Type includes the full package path for the value type for which this
	// policy applies.
	Type string
	// Policy for resolving conflict.
	Resolver ResolverType
}

CrRule provides a filter and the type of resolution to perform for a row under conflict that passes the filter.

func (CrRule) VDLIsZero

func (x CrRule) VDLIsZero() bool

func (*CrRule) VDLRead

func (x *CrRule) VDLRead(dec vdl.Decoder) error

func (CrRule) VDLReflect

func (CrRule) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.CrRule"`
})

func (CrRule) VDLWrite

func (x CrRule) VDLWrite(enc vdl.Encoder) error

type DatabaseClientMethods

type DatabaseClientMethods interface {
	// Object provides access control for Vanadium objects.
	//
	// Vanadium services implementing dynamic access control would typically embed
	// this interface and tag additional methods defined by the service with one of
	// Admin, Read, Write, Resolve etc. For example, the VDL definition of the
	// object would be:
	//
	//   package mypackage
	//
	//   import "v.io/v23/security/access"
	//   import "v.io/v23/services/permissions"
	//
	//   type MyObject interface {
	//     permissions.Object
	//     MyRead() (string, error) {access.Read}
	//     MyWrite(string) error    {access.Write}
	//   }
	//
	// If the set of pre-defined tags is insufficient, services may define their
	// own tag type and annotate all methods with this new type.
	//
	// Instead of embedding this Object interface, define SetPermissions and
	// GetPermissions in their own interface. Authorization policies will typically
	// respect annotations of a single type. For example, the VDL definition of an
	// object would be:
	//
	//  package mypackage
	//
	//  import "v.io/v23/security/access"
	//
	//  type MyTag string
	//
	//  const (
	//    Blue = MyTag("Blue")
	//    Red  = MyTag("Red")
	//  )
	//
	//  type MyObject interface {
	//    MyMethod() (string, error) {Blue}
	//
	//    // Allow clients to change access via the access.Object interface:
	//    SetPermissions(perms access.Permissions, version string) error         {Red}
	//    GetPermissions() (perms access.Permissions, version string, err error) {Blue}
	//  }
	permissions.ObjectClientMethods
	// DatabaseWatcher allows a client to watch for updates to the database. For
	// each watch request, the client will receive a reliable stream of watch events
	// without re-ordering. Only rows and collections matching at least one of the
	// patterns are returned. Rows in collections with no Read access are also
	// filtered out.
	//
	// Watching is done by starting a streaming RPC. The RPC takes a ResumeMarker
	// argument that points to a particular place in the database event log. If an
	// empty ResumeMarker is provided, the WatchStream will begin with a Change
	// batch containing the initial state, always starting with an empty update for
	// the root entity. Otherwise, the WatchStream will contain only changes since
	// the provided ResumeMarker.
	// See watch.GlobWatcher for a detailed explanation of the behavior.
	//
	// The result stream consists of a never-ending sequence of Change messages
	// (until the call fails or is canceled). Each Change contains the Name field
	// with the Vanadium name of the watched entity relative to the database:
	// - "<encCxId>/<rowKey>" for row updates
	// - "<encCxId>" for collection updates
	// - "" for the initial root entity update
	// The Value field is a StoreChange.
	// If the client has no access to a row specified in a change, that change is
	// excluded from the result stream. Collection updates are always sent and can
	// be used to determine that access to a collection is denied, potentially
	// skipping rows.
	//
	// Note: A single Watch Change batch may contain changes from more than one
	// batch as originally committed on a remote Syncbase or obtained from conflict
	// resolution. However, changes from a single original batch will always appear
	// in the same Change batch.
	DatabaseWatcherClientMethods
	// SyncgroupManager is the interface for syncgroup operations. The Database is
	// the parent of its syncgroups for permissions checking purposes.
	// TODO(hpucha): Add blessings to create/join and add a refresh method.
	SyncgroupManagerClientMethods
	// BlobManager is the interface for blob operations.
	//
	// Description of API for resumable blob creation (append-only):
	// - Up until commit, a BlobRef may be used with PutBlob, GetBlobSize,
	//   DeleteBlob, and CommitBlob. Blob creation may be resumed by obtaining the
	//   current blob size via GetBlobSize and appending to the blob via PutBlob.
	// - After commit, a blob is immutable, at which point PutBlob and CommitBlob
	//   may no longer be used.
	// - All other methods (GetBlob, FetchBlob, PinBlob, etc.) may only be used
	//   after commit.
	BlobManagerClientMethods
	// SchemaManager implements the API for managing schema metadata attached
	// to a Database.
	SchemaManagerClientMethods
	// ConflictManager interface provides all the methods necessary to handle
	// conflict resolution for a given database.
	ConflictManagerClientMethods
	// Create creates this Database. Permissions must be non-nil and include at
	// least one admin.
	//
	// Requires: Write on Service.
	// Also requires the creator's blessing to match the pattern in the newly
	// created Database's id. This requirement is waived for Admin on Service.
	Create(_ *context.T, metadata *SchemaMetadata, perms access.Permissions, _ ...rpc.CallOpt) error
	// Destroy destroys this Database, permanently removing all of its data.
	// TODO(sadovsky): Specify what happens to syncgroups.
	//
	// Requires: Admin on Database or Service.
	Destroy(*context.T, ...rpc.CallOpt) error
	// Exists returns true only if this Database exists.
	//
	// Requires: at least one tag on Database, or Read or Write on Service.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	Exists(*context.T, ...rpc.CallOpt) (bool, error)
	// ListCollections returns a list of ids of all Collections in this Database.
	// The list is sorted by blessing, then by name.
	// This method exists on Database but not on Service because for the latter
	// we can simply use glob, while for the former glob lists only Collections
	// visible in a new snapshot of the Database, ignoring user batches.
	// (Note that the same issue is present in glob on Collection, where Scan can
	// be used instead if batch awareness is required.)
	// TODO(sadovsky): Maybe switch to streaming RPC.
	//
	// Requires: Read on Database.
	ListCollections(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) ([]Id, error)
	// Exec executes a syncQL query with positional parameters and returns all
	// results as specified by the query's select/delete statement.
	// Concurrency semantics are documented in model.go.
	//
	// Requires: Read and/or Write on Collection, depending on the query:
	// - Read for select
	// - Read and Write for delete
	// TODO(ivanpi): Write should suffice for delete without v in WHERE clause.
	Exec(_ *context.T, bh BatchHandle, query string, params []*vom.RawBytes, _ ...rpc.CallOpt) (DatabaseExecClientCall, error)
	// BeginBatch creates a new batch. It returns a batch handle to pass in when
	// calling batch-aware RPCs.
	// Concurrency semantics are documented in model.go.
	// All batch-aware RPCs can also be called outside a batch (with an empty
	// handle), with the exception of Commit and Abort which only make sense on
	// a batch. Note that glob RPCs are not batch-aware.
	// TODO(sadovsky): Maybe make BatchOptions optional. Also, rename 'bo' to
	// 'opts' once v.io/i/912 is resolved for Java.
	//
	// Requires: at least one tag on Database.
	BeginBatch(_ *context.T, bo BatchOptions, _ ...rpc.CallOpt) (BatchHandle, error)
	// Commit persists the pending changes to the database.
	// If the batch is readonly, Commit() will fail with ErrReadOnlyBatch; Abort()
	// should be used instead.
	// If the BatchHandle is empty, Commit() will fail with ErrNotBoundToBatch.
	//
	// Requires: at least one tag on Database.
	// Also verifies that any changes to data and ACLs are allowed for the caller,
	// since the batch is signed by the committer. Since only the final value for
	// each key is committed and synced, changes to data need to be allowed by
	// the ACL before or after the batch. Specifically, adding Write permission,
	// changing a value based on it, then removing Write permission within a batch
	// is not allowed because it cannot be verified by remote peers.
	Commit(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) error
	// Abort notifies the server that any pending changes can be discarded.
	// It is not strictly required, but it may allow the server to release locks
	// or other resources sooner than if it was not called.
	// If the BatchHandle is empty, Abort() will fail with ErrNotBoundToBatch.
	//
	// Requires: at least one tag on Database.
	Abort(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) error
	// PauseSync pauses sync for this database. Incoming sync, as well as outgoing
	// sync of subsequent writes, will be disabled until ResumeSync is called.
	// PauseSync is idempotent.
	//
	// Requires: Admin on Database.
	PauseSync(*context.T, ...rpc.CallOpt) error
	// ResumeSync resumes sync for this database. ResumeSync is idempotent.
	//
	// Requires: Admin on Database.
	ResumeSync(*context.T, ...rpc.CallOpt) error
}

DatabaseClientMethods is the client interface containing Database methods.

Database represents a set of Collections. Batches, queries, syncgroups, and watch all operate at the Database level. Database.Glob operates over Collection ids, requiring Read on Database, returning ids sorted by blessing, then by name.

type DatabaseClientStub

type DatabaseClientStub interface {
	DatabaseClientMethods
	rpc.UniversalServiceMethods
}

DatabaseClientStub adds universal methods to DatabaseClientMethods.

func DatabaseClient

func DatabaseClient(name string) DatabaseClientStub

DatabaseClient returns a client stub for Database.

type DatabaseExecClientCall

type DatabaseExecClientCall interface {
	DatabaseExecClientStream
	// Finish blocks until the server is done, and returns the positional return
	// values for call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

DatabaseExecClientCall represents the call returned from Database.Exec.

type DatabaseExecClientStream

type DatabaseExecClientStream interface {
	// RecvStream returns the receiver side of the Database.Exec client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() []*vom.RawBytes
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

DatabaseExecClientStream is the client stream for Database.Exec.

type DatabaseExecServerCall

type DatabaseExecServerCall interface {
	rpc.ServerCall
	DatabaseExecServerStream
}

DatabaseExecServerCall represents the context passed to Database.Exec.

type DatabaseExecServerCallStub

type DatabaseExecServerCallStub struct {
	rpc.StreamServerCall
}

DatabaseExecServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements DatabaseExecServerCall.

func (*DatabaseExecServerCallStub) Init

Init initializes DatabaseExecServerCallStub from rpc.StreamServerCall.

func (*DatabaseExecServerCallStub) SendStream

func (s *DatabaseExecServerCallStub) SendStream() interface {
	Send(item []*vom.RawBytes) error
}

SendStream returns the send side of the Database.Exec server stream.

type DatabaseExecServerStream

type DatabaseExecServerStream interface {
	// SendStream returns the send side of the Database.Exec server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item []*vom.RawBytes) error
	}
}

DatabaseExecServerStream is the server stream for Database.Exec.

type DatabaseServerMethods

type DatabaseServerMethods interface {
	// Object provides access control for Vanadium objects.
	//
	// Vanadium services implementing dynamic access control would typically embed
	// this interface and tag additional methods defined by the service with one of
	// Admin, Read, Write, Resolve etc. For example, the VDL definition of the
	// object would be:
	//
	//   package mypackage
	//
	//   import "v.io/v23/security/access"
	//   import "v.io/v23/services/permissions"
	//
	//   type MyObject interface {
	//     permissions.Object
	//     MyRead() (string, error) {access.Read}
	//     MyWrite(string) error    {access.Write}
	//   }
	//
	// If the set of pre-defined tags is insufficient, services may define their
	// own tag type and annotate all methods with this new type.
	//
	// Instead of embedding this Object interface, define SetPermissions and
	// GetPermissions in their own interface. Authorization policies will typically
	// respect annotations of a single type. For example, the VDL definition of an
	// object would be:
	//
	//  package mypackage
	//
	//  import "v.io/v23/security/access"
	//
	//  type MyTag string
	//
	//  const (
	//    Blue = MyTag("Blue")
	//    Red  = MyTag("Red")
	//  )
	//
	//  type MyObject interface {
	//    MyMethod() (string, error) {Blue}
	//
	//    // Allow clients to change access via the access.Object interface:
	//    SetPermissions(perms access.Permissions, version string) error         {Red}
	//    GetPermissions() (perms access.Permissions, version string, err error) {Blue}
	//  }
	permissions.ObjectServerMethods
	// DatabaseWatcher allows a client to watch for updates to the database. For
	// each watch request, the client will receive a reliable stream of watch events
	// without re-ordering. Only rows and collections matching at least one of the
	// patterns are returned. Rows in collections with no Read access are also
	// filtered out.
	//
	// Watching is done by starting a streaming RPC. The RPC takes a ResumeMarker
	// argument that points to a particular place in the database event log. If an
	// empty ResumeMarker is provided, the WatchStream will begin with a Change
	// batch containing the initial state, always starting with an empty update for
	// the root entity. Otherwise, the WatchStream will contain only changes since
	// the provided ResumeMarker.
	// See watch.GlobWatcher for a detailed explanation of the behavior.
	//
	// The result stream consists of a never-ending sequence of Change messages
	// (until the call fails or is canceled). Each Change contains the Name field
	// with the Vanadium name of the watched entity relative to the database:
	// - "<encCxId>/<rowKey>" for row updates
	// - "<encCxId>" for collection updates
	// - "" for the initial root entity update
	// The Value field is a StoreChange.
	// If the client has no access to a row specified in a change, that change is
	// excluded from the result stream. Collection updates are always sent and can
	// be used to determine that access to a collection is denied, potentially
	// skipping rows.
	//
	// Note: A single Watch Change batch may contain changes from more than one
	// batch as originally committed on a remote Syncbase or obtained from conflict
	// resolution. However, changes from a single original batch will always appear
	// in the same Change batch.
	DatabaseWatcherServerMethods
	// SyncgroupManager is the interface for syncgroup operations. The Database is
	// the parent of its syncgroups for permissions checking purposes.
	// TODO(hpucha): Add blessings to create/join and add a refresh method.
	SyncgroupManagerServerMethods
	// BlobManager is the interface for blob operations.
	//
	// Description of API for resumable blob creation (append-only):
	// - Up until commit, a BlobRef may be used with PutBlob, GetBlobSize,
	//   DeleteBlob, and CommitBlob. Blob creation may be resumed by obtaining the
	//   current blob size via GetBlobSize and appending to the blob via PutBlob.
	// - After commit, a blob is immutable, at which point PutBlob and CommitBlob
	//   may no longer be used.
	// - All other methods (GetBlob, FetchBlob, PinBlob, etc.) may only be used
	//   after commit.
	BlobManagerServerMethods
	// SchemaManager implements the API for managing schema metadata attached
	// to a Database.
	SchemaManagerServerMethods
	// ConflictManager interface provides all the methods necessary to handle
	// conflict resolution for a given database.
	ConflictManagerServerMethods
	// Create creates this Database. Permissions must be non-nil and include at
	// least one admin.
	//
	// Requires: Write on Service.
	// Also requires the creator's blessing to match the pattern in the newly
	// created Database's id. This requirement is waived for Admin on Service.
	Create(_ *context.T, _ rpc.ServerCall, metadata *SchemaMetadata, perms access.Permissions) error
	// Destroy destroys this Database, permanently removing all of its data.
	// TODO(sadovsky): Specify what happens to syncgroups.
	//
	// Requires: Admin on Database or Service.
	Destroy(*context.T, rpc.ServerCall) error
	// Exists returns true only if this Database exists.
	//
	// Requires: at least one tag on Database, or Read or Write on Service.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	Exists(*context.T, rpc.ServerCall) (bool, error)
	// ListCollections returns a list of ids of all Collections in this Database.
	// The list is sorted by blessing, then by name.
	// This method exists on Database but not on Service because for the latter
	// we can simply use glob, while for the former glob lists only Collections
	// visible in a new snapshot of the Database, ignoring user batches.
	// (Note that the same issue is present in glob on Collection, where Scan can
	// be used instead if batch awareness is required.)
	// TODO(sadovsky): Maybe switch to streaming RPC.
	//
	// Requires: Read on Database.
	ListCollections(_ *context.T, _ rpc.ServerCall, bh BatchHandle) ([]Id, error)
	// Exec executes a syncQL query with positional parameters and returns all
	// results as specified by the query's select/delete statement.
	// Concurrency semantics are documented in model.go.
	//
	// Requires: Read and/or Write on Collection, depending on the query:
	// - Read for select
	// - Read and Write for delete
	// TODO(ivanpi): Write should suffice for delete without v in WHERE clause.
	Exec(_ *context.T, _ DatabaseExecServerCall, bh BatchHandle, query string, params []*vom.RawBytes) error
	// BeginBatch creates a new batch. It returns a batch handle to pass in when
	// calling batch-aware RPCs.
	// Concurrency semantics are documented in model.go.
	// All batch-aware RPCs can also be called outside a batch (with an empty
	// handle), with the exception of Commit and Abort which only make sense on
	// a batch. Note that glob RPCs are not batch-aware.
	// TODO(sadovsky): Maybe make BatchOptions optional. Also, rename 'bo' to
	// 'opts' once v.io/i/912 is resolved for Java.
	//
	// Requires: at least one tag on Database.
	BeginBatch(_ *context.T, _ rpc.ServerCall, bo BatchOptions) (BatchHandle, error)
	// Commit persists the pending changes to the database.
	// If the batch is readonly, Commit() will fail with ErrReadOnlyBatch; Abort()
	// should be used instead.
	// If the BatchHandle is empty, Commit() will fail with ErrNotBoundToBatch.
	//
	// Requires: at least one tag on Database.
	// Also verifies that any changes to data and ACLs are allowed for the caller,
	// since the batch is signed by the committer. Since only the final value for
	// each key is committed and synced, changes to data need to be allowed by
	// the ACL before or after the batch. Specifically, adding Write permission,
	// changing a value based on it, then removing Write permission within a batch
	// is not allowed because it cannot be verified by remote peers.
	Commit(_ *context.T, _ rpc.ServerCall, bh BatchHandle) error
	// Abort notifies the server that any pending changes can be discarded.
	// It is not strictly required, but it may allow the server to release locks
	// or other resources sooner than if it was not called.
	// If the BatchHandle is empty, Abort() will fail with ErrNotBoundToBatch.
	//
	// Requires: at least one tag on Database.
	Abort(_ *context.T, _ rpc.ServerCall, bh BatchHandle) error
	// PauseSync pauses sync for this database. Incoming sync, as well as outgoing
	// sync of subsequent writes, will be disabled until ResumeSync is called.
	// PauseSync is idempotent.
	//
	// Requires: Admin on Database.
	PauseSync(*context.T, rpc.ServerCall) error
	// ResumeSync resumes sync for this database. ResumeSync is idempotent.
	//
	// Requires: Admin on Database.
	ResumeSync(*context.T, rpc.ServerCall) error
}

DatabaseServerMethods is the interface a server writer implements for Database.

Database represents a set of Collections. Batches, queries, syncgroups, and watch all operate at the Database level. Database.Glob operates over Collection ids, requiring Read on Database, returning ids sorted by blessing, then by name.

type DatabaseServerStub

type DatabaseServerStub interface {
	DatabaseServerStubMethods
	// Describe the Database interfaces.
	Describe__() []rpc.InterfaceDesc
}

DatabaseServerStub adds universal methods to DatabaseServerStubMethods.

func DatabaseServer

func DatabaseServer(impl DatabaseServerMethods) DatabaseServerStub

DatabaseServer returns a server stub for Database. It converts an implementation of DatabaseServerMethods into an object that may be used by rpc.Server.

type DatabaseServerStubMethods

type DatabaseServerStubMethods interface {
	// Object provides access control for Vanadium objects.
	//
	// Vanadium services implementing dynamic access control would typically embed
	// this interface and tag additional methods defined by the service with one of
	// Admin, Read, Write, Resolve etc. For example, the VDL definition of the
	// object would be:
	//
	//   package mypackage
	//
	//   import "v.io/v23/security/access"
	//   import "v.io/v23/services/permissions"
	//
	//   type MyObject interface {
	//     permissions.Object
	//     MyRead() (string, error) {access.Read}
	//     MyWrite(string) error    {access.Write}
	//   }
	//
	// If the set of pre-defined tags is insufficient, services may define their
	// own tag type and annotate all methods with this new type.
	//
	// Instead of embedding this Object interface, define SetPermissions and
	// GetPermissions in their own interface. Authorization policies will typically
	// respect annotations of a single type. For example, the VDL definition of an
	// object would be:
	//
	//  package mypackage
	//
	//  import "v.io/v23/security/access"
	//
	//  type MyTag string
	//
	//  const (
	//    Blue = MyTag("Blue")
	//    Red  = MyTag("Red")
	//  )
	//
	//  type MyObject interface {
	//    MyMethod() (string, error) {Blue}
	//
	//    // Allow clients to change access via the access.Object interface:
	//    SetPermissions(perms access.Permissions, version string) error         {Red}
	//    GetPermissions() (perms access.Permissions, version string, err error) {Blue}
	//  }
	permissions.ObjectServerStubMethods
	// DatabaseWatcher allows a client to watch for updates to the database. For
	// each watch request, the client will receive a reliable stream of watch events
	// without re-ordering. Only rows and collections matching at least one of the
	// patterns are returned. Rows in collections with no Read access are also
	// filtered out.
	//
	// Watching is done by starting a streaming RPC. The RPC takes a ResumeMarker
	// argument that points to a particular place in the database event log. If an
	// empty ResumeMarker is provided, the WatchStream will begin with a Change
	// batch containing the initial state, always starting with an empty update for
	// the root entity. Otherwise, the WatchStream will contain only changes since
	// the provided ResumeMarker.
	// See watch.GlobWatcher for a detailed explanation of the behavior.
	//
	// The result stream consists of a never-ending sequence of Change messages
	// (until the call fails or is canceled). Each Change contains the Name field
	// with the Vanadium name of the watched entity relative to the database:
	// - "<encCxId>/<rowKey>" for row updates
	// - "<encCxId>" for collection updates
	// - "" for the initial root entity update
	// The Value field is a StoreChange.
	// If the client has no access to a row specified in a change, that change is
	// excluded from the result stream. Collection updates are always sent and can
	// be used to determine that access to a collection is denied, potentially
	// skipping rows.
	//
	// Note: A single Watch Change batch may contain changes from more than one
	// batch as originally committed on a remote Syncbase or obtained from conflict
	// resolution. However, changes from a single original batch will always appear
	// in the same Change batch.
	DatabaseWatcherServerStubMethods
	// SyncgroupManager is the interface for syncgroup operations. The Database is
	// the parent of its syncgroups for permissions checking purposes.
	// TODO(hpucha): Add blessings to create/join and add a refresh method.
	SyncgroupManagerServerStubMethods
	// BlobManager is the interface for blob operations.
	//
	// Description of API for resumable blob creation (append-only):
	// - Up until commit, a BlobRef may be used with PutBlob, GetBlobSize,
	//   DeleteBlob, and CommitBlob. Blob creation may be resumed by obtaining the
	//   current blob size via GetBlobSize and appending to the blob via PutBlob.
	// - After commit, a blob is immutable, at which point PutBlob and CommitBlob
	//   may no longer be used.
	// - All other methods (GetBlob, FetchBlob, PinBlob, etc.) may only be used
	//   after commit.
	BlobManagerServerStubMethods
	// SchemaManager implements the API for managing schema metadata attached
	// to a Database.
	SchemaManagerServerStubMethods
	// ConflictManager interface provides all the methods necessary to handle
	// conflict resolution for a given database.
	ConflictManagerServerStubMethods
	// Create creates this Database. Permissions must be non-nil and include at
	// least one admin.
	//
	// Requires: Write on Service.
	// Also requires the creator's blessing to match the pattern in the newly
	// created Database's id. This requirement is waived for Admin on Service.
	Create(_ *context.T, _ rpc.ServerCall, metadata *SchemaMetadata, perms access.Permissions) error
	// Destroy destroys this Database, permanently removing all of its data.
	// TODO(sadovsky): Specify what happens to syncgroups.
	//
	// Requires: Admin on Database or Service.
	Destroy(*context.T, rpc.ServerCall) error
	// Exists returns true only if this Database exists.
	//
	// Requires: at least one tag on Database, or Read or Write on Service.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	Exists(*context.T, rpc.ServerCall) (bool, error)
	// ListCollections returns a list of ids of all Collections in this Database.
	// The list is sorted by blessing, then by name.
	// This method exists on Database but not on Service because for the latter
	// we can simply use glob, while for the former glob lists only Collections
	// visible in a new snapshot of the Database, ignoring user batches.
	// (Note that the same issue is present in glob on Collection, where Scan can
	// be used instead if batch awareness is required.)
	// TODO(sadovsky): Maybe switch to streaming RPC.
	//
	// Requires: Read on Database.
	ListCollections(_ *context.T, _ rpc.ServerCall, bh BatchHandle) ([]Id, error)
	// Exec executes a syncQL query with positional parameters and returns all
	// results as specified by the query's select/delete statement.
	// Concurrency semantics are documented in model.go.
	//
	// Requires: Read and/or Write on Collection, depending on the query:
	// - Read for select
	// - Read and Write for delete
	// TODO(ivanpi): Write should suffice for delete without v in WHERE clause.
	Exec(_ *context.T, _ *DatabaseExecServerCallStub, bh BatchHandle, query string, params []*vom.RawBytes) error
	// BeginBatch creates a new batch. It returns a batch handle to pass in when
	// calling batch-aware RPCs.
	// Concurrency semantics are documented in model.go.
	// All batch-aware RPCs can also be called outside a batch (with an empty
	// handle), with the exception of Commit and Abort which only make sense on
	// a batch. Note that glob RPCs are not batch-aware.
	// TODO(sadovsky): Maybe make BatchOptions optional. Also, rename 'bo' to
	// 'opts' once v.io/i/912 is resolved for Java.
	//
	// Requires: at least one tag on Database.
	BeginBatch(_ *context.T, _ rpc.ServerCall, bo BatchOptions) (BatchHandle, error)
	// Commit persists the pending changes to the database.
	// If the batch is readonly, Commit() will fail with ErrReadOnlyBatch; Abort()
	// should be used instead.
	// If the BatchHandle is empty, Commit() will fail with ErrNotBoundToBatch.
	//
	// Requires: at least one tag on Database.
	// Also verifies that any changes to data and ACLs are allowed for the caller,
	// since the batch is signed by the committer. Since only the final value for
	// each key is committed and synced, changes to data need to be allowed by
	// the ACL before or after the batch. Specifically, adding Write permission,
	// changing a value based on it, then removing Write permission within a batch
	// is not allowed because it cannot be verified by remote peers.
	Commit(_ *context.T, _ rpc.ServerCall, bh BatchHandle) error
	// Abort notifies the server that any pending changes can be discarded.
	// It is not strictly required, but it may allow the server to release locks
	// or other resources sooner than if it was not called.
	// If the BatchHandle is empty, Abort() will fail with ErrNotBoundToBatch.
	//
	// Requires: at least one tag on Database.
	Abort(_ *context.T, _ rpc.ServerCall, bh BatchHandle) error
	// PauseSync pauses sync for this database. Incoming sync, as well as outgoing
	// sync of subsequent writes, will be disabled until ResumeSync is called.
	// PauseSync is idempotent.
	//
	// Requires: Admin on Database.
	PauseSync(*context.T, rpc.ServerCall) error
	// ResumeSync resumes sync for this database. ResumeSync is idempotent.
	//
	// Requires: Admin on Database.
	ResumeSync(*context.T, rpc.ServerCall) error
}

DatabaseServerStubMethods is the server interface containing Database methods, as expected by rpc.Server. The only difference between this interface and DatabaseServerMethods is the streaming methods.

type DatabaseWatcherClientMethods

type DatabaseWatcherClientMethods interface {
	// GlobWatcher allows a client to receive updates for changes to objects
	// that match a pattern.  See the package comments for details.
	watch.GlobWatcherClientMethods
	// GetResumeMarker returns the ResumeMarker that points to the current end
	// of the event log. GetResumeMarker() can be called on a batch.
	//
	// Requires: at least one tag on Database.
	GetResumeMarker(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) (watch.ResumeMarker, error)
	// WatchPatterns returns a stream of changes that match any of the specified
	// patterns. At least one pattern must be specified.
	//
	// Requires: Read on Database.
	WatchPatterns(_ *context.T, resumeMarker watch.ResumeMarker, patterns []CollectionRowPattern, _ ...rpc.CallOpt) (DatabaseWatcherWatchPatternsClientCall, error)
}

DatabaseWatcherClientMethods is the client interface containing DatabaseWatcher methods.

DatabaseWatcher allows a client to watch for updates to the database. For each watch request, the client will receive a reliable stream of watch events without re-ordering. Only rows and collections matching at least one of the patterns are returned. Rows in collections with no Read access are also filtered out.

Watching is done by starting a streaming RPC. The RPC takes a ResumeMarker argument that points to a particular place in the database event log. If an empty ResumeMarker is provided, the WatchStream will begin with a Change batch containing the initial state, always starting with an empty update for the root entity. Otherwise, the WatchStream will contain only changes since the provided ResumeMarker. See watch.GlobWatcher for a detailed explanation of the behavior.

The result stream consists of a never-ending sequence of Change messages (until the call fails or is canceled). Each Change contains the Name field with the Vanadium name of the watched entity relative to the database: - "<encCxId>/<rowKey>" for row updates - "<encCxId>" for collection updates - "" for the initial root entity update The Value field is a StoreChange. If the client has no access to a row specified in a change, that change is excluded from the result stream. Collection updates are always sent and can be used to determine that access to a collection is denied, potentially skipping rows.

Note: A single Watch Change batch may contain changes from more than one batch as originally committed on a remote Syncbase or obtained from conflict resolution. However, changes from a single original batch will always appear in the same Change batch.

type DatabaseWatcherClientStub

type DatabaseWatcherClientStub interface {
	DatabaseWatcherClientMethods
	rpc.UniversalServiceMethods
}

DatabaseWatcherClientStub adds universal methods to DatabaseWatcherClientMethods.

func DatabaseWatcherClient

func DatabaseWatcherClient(name string) DatabaseWatcherClientStub

DatabaseWatcherClient returns a client stub for DatabaseWatcher.

type DatabaseWatcherServerMethods

type DatabaseWatcherServerMethods interface {
	// GlobWatcher allows a client to receive updates for changes to objects
	// that match a pattern.  See the package comments for details.
	watch.GlobWatcherServerMethods
	// GetResumeMarker returns the ResumeMarker that points to the current end
	// of the event log. GetResumeMarker() can be called on a batch.
	//
	// Requires: at least one tag on Database.
	GetResumeMarker(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (watch.ResumeMarker, error)
	// WatchPatterns returns a stream of changes that match any of the specified
	// patterns. At least one pattern must be specified.
	//
	// Requires: Read on Database.
	WatchPatterns(_ *context.T, _ DatabaseWatcherWatchPatternsServerCall, resumeMarker watch.ResumeMarker, patterns []CollectionRowPattern) error
}

DatabaseWatcherServerMethods is the interface a server writer implements for DatabaseWatcher.

DatabaseWatcher allows a client to watch for updates to the database. For each watch request, the client will receive a reliable stream of watch events without re-ordering. Only rows and collections matching at least one of the patterns are returned. Rows in collections with no Read access are also filtered out.

Watching is done by starting a streaming RPC. The RPC takes a ResumeMarker argument that points to a particular place in the database event log. If an empty ResumeMarker is provided, the WatchStream will begin with a Change batch containing the initial state, always starting with an empty update for the root entity. Otherwise, the WatchStream will contain only changes since the provided ResumeMarker. See watch.GlobWatcher for a detailed explanation of the behavior.

The result stream consists of a never-ending sequence of Change messages (until the call fails or is canceled). Each Change contains the Name field with the Vanadium name of the watched entity relative to the database: - "<encCxId>/<rowKey>" for row updates - "<encCxId>" for collection updates - "" for the initial root entity update The Value field is a StoreChange. If the client has no access to a row specified in a change, that change is excluded from the result stream. Collection updates are always sent and can be used to determine that access to a collection is denied, potentially skipping rows.

Note: A single Watch Change batch may contain changes from more than one batch as originally committed on a remote Syncbase or obtained from conflict resolution. However, changes from a single original batch will always appear in the same Change batch.

type DatabaseWatcherServerStub

type DatabaseWatcherServerStub interface {
	DatabaseWatcherServerStubMethods
	// Describe the DatabaseWatcher interfaces.
	Describe__() []rpc.InterfaceDesc
}

DatabaseWatcherServerStub adds universal methods to DatabaseWatcherServerStubMethods.

func DatabaseWatcherServer

func DatabaseWatcherServer(impl DatabaseWatcherServerMethods) DatabaseWatcherServerStub

DatabaseWatcherServer returns a server stub for DatabaseWatcher. It converts an implementation of DatabaseWatcherServerMethods into an object that may be used by rpc.Server.

type DatabaseWatcherServerStubMethods

type DatabaseWatcherServerStubMethods interface {
	// GlobWatcher allows a client to receive updates for changes to objects
	// that match a pattern.  See the package comments for details.
	watch.GlobWatcherServerStubMethods
	// GetResumeMarker returns the ResumeMarker that points to the current end
	// of the event log. GetResumeMarker() can be called on a batch.
	//
	// Requires: at least one tag on Database.
	GetResumeMarker(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (watch.ResumeMarker, error)
	// WatchPatterns returns a stream of changes that match any of the specified
	// patterns. At least one pattern must be specified.
	//
	// Requires: Read on Database.
	WatchPatterns(_ *context.T, _ *DatabaseWatcherWatchPatternsServerCallStub, resumeMarker watch.ResumeMarker, patterns []CollectionRowPattern) error
}

DatabaseWatcherServerStubMethods is the server interface containing DatabaseWatcher methods, as expected by rpc.Server. The only difference between this interface and DatabaseWatcherServerMethods is the streaming methods.

type DatabaseWatcherWatchPatternsClientCall

type DatabaseWatcherWatchPatternsClientCall interface {
	DatabaseWatcherWatchPatternsClientStream
	// Finish blocks until the server is done, and returns the positional return
	// values for call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

DatabaseWatcherWatchPatternsClientCall represents the call returned from DatabaseWatcher.WatchPatterns.

type DatabaseWatcherWatchPatternsClientStream

type DatabaseWatcherWatchPatternsClientStream interface {
	// RecvStream returns the receiver side of the DatabaseWatcher.WatchPatterns client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() watch.Change
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
}

DatabaseWatcherWatchPatternsClientStream is the client stream for DatabaseWatcher.WatchPatterns.

type DatabaseWatcherWatchPatternsServerCall

type DatabaseWatcherWatchPatternsServerCall interface {
	rpc.ServerCall
	DatabaseWatcherWatchPatternsServerStream
}

DatabaseWatcherWatchPatternsServerCall represents the context passed to DatabaseWatcher.WatchPatterns.

type DatabaseWatcherWatchPatternsServerCallStub

type DatabaseWatcherWatchPatternsServerCallStub struct {
	rpc.StreamServerCall
}

DatabaseWatcherWatchPatternsServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements DatabaseWatcherWatchPatternsServerCall.

func (*DatabaseWatcherWatchPatternsServerCallStub) Init

Init initializes DatabaseWatcherWatchPatternsServerCallStub from rpc.StreamServerCall.

func (*DatabaseWatcherWatchPatternsServerCallStub) SendStream

func (s *DatabaseWatcherWatchPatternsServerCallStub) SendStream() interface {
	Send(item watch.Change) error
}

SendStream returns the send side of the DatabaseWatcher.WatchPatterns server stream.

type DatabaseWatcherWatchPatternsServerStream

type DatabaseWatcherWatchPatternsServerStream interface {
	// SendStream returns the send side of the DatabaseWatcher.WatchPatterns server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item watch.Change) error
	}
}

DatabaseWatcherWatchPatternsServerStream is the server stream for DatabaseWatcher.WatchPatterns.

type DevModeUpdateVClockOpts

type DevModeUpdateVClockOpts struct {
	// If specified, sets the NTP host to talk to for subsequent NTP requests.
	NtpHost string
	// If Now is specified, the fake system clock is updated to the given values
	// of Now and ElapsedTime. If Now is not specified (i.e. takes the zero
	// value), the system clock is not touched by DevModeUpdateVClock.
	Now         time.Time
	ElapsedTime time.Duration
	// If specified, the clock daemon's local and/or NTP update code is triggered
	// after applying the updates specified by the fields above. (Helpful because
	// otherwise these only run periodically.) These functions work even if the
	// clock daemon hasn't been started.
	DoNtpUpdate   bool
	DoLocalUpdate bool
}

DevModeUpdateVClockOpts specifies what DevModeUpdateVClock should do, as described below.

func (DevModeUpdateVClockOpts) VDLIsZero

func (x DevModeUpdateVClockOpts) VDLIsZero() bool

func (*DevModeUpdateVClockOpts) VDLRead

func (x *DevModeUpdateVClockOpts) VDLRead(dec vdl.Decoder) error

func (DevModeUpdateVClockOpts) VDLReflect

func (DevModeUpdateVClockOpts) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.DevModeUpdateVClockOpts"`
})

func (DevModeUpdateVClockOpts) VDLWrite

func (x DevModeUpdateVClockOpts) VDLWrite(enc vdl.Encoder) error

type Id

type Id struct {
	Blessing string
	Name     string
}

Id is a {blessing, name} pair, used to identify a database or a collection.

func ParseId

func ParseId(from string) (Id, error)

ParseId parses an Id from a string formatted according to the String method.

func (Id) String

func (id Id) String() string

String implements Stringer.

func (Id) VDLIsZero

func (x Id) VDLIsZero() bool

func (*Id) VDLRead

func (x *Id) VDLRead(dec vdl.Decoder) error

func (Id) VDLReflect

func (Id) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.Id"`
})

func (Id) VDLWrite

func (x Id) VDLWrite(enc vdl.Encoder) error

type KeyValue

type KeyValue struct {
	Key   string
	Value *vom.RawBytes
}

KeyValue is a key-value pair.

func (KeyValue) VDLIsZero

func (x KeyValue) VDLIsZero() bool

func (*KeyValue) VDLRead

func (x *KeyValue) VDLRead(dec vdl.Decoder) error

func (KeyValue) VDLReflect

func (KeyValue) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.KeyValue"`
})

func (KeyValue) VDLWrite

func (x KeyValue) VDLWrite(enc vdl.Encoder) error

type Operation

type Operation interface {
	// Index returns the field index.
	Index() int
	// Interface returns the field value as an interface.
	Interface() interface{}
	// Name returns the field name.
	Name() string
	// VDLReflect describes the Operation union type.
	VDLReflect(__OperationReflect)
	VDLIsZero() bool
	VDLWrite(vdl.Encoder) error
}

Operation represents any single field of the Operation union type.

Operation represents a specific operation on a row or a set of rows that is a part of the conflict.

type OperationRead

type OperationRead struct{ Value RowOp }

OperationRead represents field Read of the Operation union type.

Read represents a read operation performed on a specific row. For a given row key there can only be at max one Read operation within a conflict.

func (OperationRead) Index

func (x OperationRead) Index() int

func (OperationRead) Interface

func (x OperationRead) Interface() interface{}

func (OperationRead) Name

func (x OperationRead) Name() string

func (OperationRead) VDLIsZero

func (x OperationRead) VDLIsZero() bool

func (OperationRead) VDLReflect

func (x OperationRead) VDLReflect(__OperationReflect)

func (OperationRead) VDLWrite

func (x OperationRead) VDLWrite(enc vdl.Encoder) error

type OperationScan

type OperationScan struct{ Value ScanOp }

OperationScan represents field Scan of the Operation union type.

Scan represents a scan operation performed over a specific range of keys. For a given key range there can be at max one ScanOp within the Conflict.

func (OperationScan) Index

func (x OperationScan) Index() int

func (OperationScan) Interface

func (x OperationScan) Interface() interface{}

func (OperationScan) Name

func (x OperationScan) Name() string

func (OperationScan) VDLIsZero

func (x OperationScan) VDLIsZero() bool

func (OperationScan) VDLReflect

func (x OperationScan) VDLReflect(__OperationReflect)

func (OperationScan) VDLWrite

func (x OperationScan) VDLWrite(enc vdl.Encoder) error

type OperationWrite

type OperationWrite struct{ Value RowOp }

OperationWrite represents field Write of the Operation union type.

Write represents a write operation performed on a specific row. For a given row key there can only be at max one Write operation within a conflict.

func (OperationWrite) Index

func (x OperationWrite) Index() int

func (OperationWrite) Interface

func (x OperationWrite) Interface() interface{}

func (OperationWrite) Name

func (x OperationWrite) Name() string

func (OperationWrite) VDLIsZero

func (x OperationWrite) VDLIsZero() bool

func (OperationWrite) VDLReflect

func (x OperationWrite) VDLReflect(__OperationReflect)

func (OperationWrite) VDLWrite

func (x OperationWrite) VDLWrite(enc vdl.Encoder) error

type ResolutionInfo

type ResolutionInfo struct {
	// Key is the key under conflict.
	Key string
	// Selection represents the value that was selected as resolution.
	Selection ValueSelection
	// Result is the resolved value for the key. This field should be used only
	// if value of Selection field is 'Other'. If the result of a resolution is
	// delete for this key then add Value with nil Bytes.
	Result *Value
	// Continued represents whether the batch of ResolutionInfos has ended.
	Continued bool
}

ResolutionInfo contains the application’s reply to a conflict for a key, providing the resolution value. The resolution may be over a group of keys in which case the application must send a stream of ResolutionInfos with the Continued field for the last ResolutionInfo representing the end of the batch with a value false. ResolutionInfos sent as part of a batch will be committed as a batch. If the commit fails, the Conflict will be re-sent.

func (ResolutionInfo) VDLIsZero

func (x ResolutionInfo) VDLIsZero() bool

func (*ResolutionInfo) VDLRead

func (x *ResolutionInfo) VDLRead(dec vdl.Decoder) error

func (ResolutionInfo) VDLReflect

func (ResolutionInfo) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.ResolutionInfo"`
})

func (ResolutionInfo) VDLWrite

func (x ResolutionInfo) VDLWrite(enc vdl.Encoder) error

type ResolverType

type ResolverType int

ResolverType defines the possible conflict resolution policies. A Conflict is defined as presence of two independent sets of updates originating from the same version of an object. Syncbase uses version vectors to determine sequence of changes to a given row. Hence if device A updates a row with key "foo" from version V3 to V4, then syncs with device B which further updates the same row from version V4 to V5 and then V5 is synced back to device A, device A will see V5 as a forward progression of "foo" and not a conflict with V3 of "foo". But in the meantime if device A had already updated "foo" again from version V4 to version V6 then there is a conflict between V5 and V6 with V4 being the common ancestor.

const (
	ResolverTypeLastWins ResolverType = iota
	ResolverTypeAppResolves
	ResolverTypeDefer
)

func ResolverTypeFromString

func ResolverTypeFromString(label string) (x ResolverType, err error)

ResolverTypeFromString creates a ResolverType from a string label.

func (*ResolverType) Set

func (x *ResolverType) Set(label string) error

Set assigns label to x.

func (ResolverType) String

func (x ResolverType) String() string

String returns the string label of x.

func (ResolverType) VDLIsZero

func (x ResolverType) VDLIsZero() bool

func (*ResolverType) VDLRead

func (x *ResolverType) VDLRead(dec vdl.Decoder) error

func (ResolverType) VDLReflect

func (ResolverType) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.ResolverType"`
	Enum struct{ LastWins, AppResolves, Defer string }
})

func (ResolverType) VDLWrite

func (x ResolverType) VDLWrite(enc vdl.Encoder) error

type RowClientMethods

type RowClientMethods interface {
	// Exists returns true only if this Row exists.
	//
	// Requires: Read or Write on Collection.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	// If Collection does not exist, returned value is identical to
	// Collection.Exists().
	// Note, write methods on Row do not leak information whether the Row existed
	// before, but Write is sufficient to call Exists. Therefore, Read protects
	// Row data and listing, but not Row existence.
	Exists(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) (bool, error)
	// Get returns the value for this Row.
	//
	// Requires: Read on Collection.
	Get(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) (*vom.RawBytes, error)
	// Put writes the given value for this Row.
	//
	// Requires: Write on Collection.
	Put(_ *context.T, bh BatchHandle, value *vom.RawBytes, _ ...rpc.CallOpt) error
	// Delete deletes this Row.
	//
	// Requires: Write on Collection.
	Delete(_ *context.T, bh BatchHandle, _ ...rpc.CallOpt) error
}

RowClientMethods is the client interface containing Row methods.

Row represents a single row in a Collection. All access checks are performed against the Collection ACL.

type RowClientStub

type RowClientStub interface {
	RowClientMethods
	rpc.UniversalServiceMethods
}

RowClientStub adds universal methods to RowClientMethods.

func RowClient

func RowClient(name string) RowClientStub

RowClient returns a client stub for Row.

type RowInfo

type RowInfo struct {
	// Op is a specific operation represented by RowInfo
	Op Operation
	// BatchIds contains ids of all batches that this RowInfo is a part of.
	BatchIds []uint64
}

RowInfo contains a single operation performed on a row (in case of read or write) or a range or rows (in case of scan) along with a mapping to each of the batches that this operation belongs to. For example, if Row1 was updated on local syncbase conflicting with a write on remote syncbase as part of two separate batches, then it will be represented by a single RowInfo with Write Operation containing the respective local and remote values along with the batch id for both batches stored in the BatchIds field.

func (RowInfo) VDLIsZero

func (x RowInfo) VDLIsZero() bool

func (*RowInfo) VDLRead

func (x *RowInfo) VDLRead(dec vdl.Decoder) error

func (RowInfo) VDLReflect

func (RowInfo) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.RowInfo"`
})

func (RowInfo) VDLWrite

func (x RowInfo) VDLWrite(enc vdl.Encoder) error

type RowOp

type RowOp struct {
	// The key under conflict.
	Key string
	// LocalValue contains the value read or written by local syncbase or nil.
	LocalValue *Value
	// RemoteValue contains the value read or written by remote syncbase or nil.
	RemoteValue *Value
	// AncestorValue contains the value for the key which is the lowest common
	// ancestor of the two values represented by LocalValue and RemoteValue or
	// nil if no ancestor exists or if the operation was read.
	AncestorValue *Value
}

RowOp represents a read or write operation on a row corresponding to the given key.

func (RowOp) VDLIsZero

func (x RowOp) VDLIsZero() bool

func (*RowOp) VDLRead

func (x *RowOp) VDLRead(dec vdl.Decoder) error

func (RowOp) VDLReflect

func (RowOp) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.RowOp"`
})

func (RowOp) VDLWrite

func (x RowOp) VDLWrite(enc vdl.Encoder) error

type RowServerMethods

type RowServerMethods interface {
	// Exists returns true only if this Row exists.
	//
	// Requires: Read or Write on Collection.
	// Otherwise, ErrNoExistOrNoAccess is returned.
	// If Collection does not exist, returned value is identical to
	// Collection.Exists().
	// Note, write methods on Row do not leak information whether the Row existed
	// before, but Write is sufficient to call Exists. Therefore, Read protects
	// Row data and listing, but not Row existence.
	Exists(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (bool, error)
	// Get returns the value for this Row.
	//
	// Requires: Read on Collection.
	Get(_ *context.T, _ rpc.ServerCall, bh BatchHandle) (*vom.RawBytes, error)
	// Put writes the given value for this Row.
	//
	// Requires: Write on Collection.
	Put(_ *context.T, _ rpc.ServerCall, bh BatchHandle, value *vom.RawBytes) error
	// Delete deletes this Row.
	//
	// Requires: Write on Collection.
	Delete(_ *context.T, _ rpc.ServerCall, bh BatchHandle) error
}

RowServerMethods is the interface a server writer implements for Row.

Row represents a single row in a Collection. All access checks are performed against the Collection ACL.

type RowServerStub

type RowServerStub interface {
	RowServerStubMethods
	// Describe the Row interfaces.
	Describe__() []rpc.InterfaceDesc
}

RowServerStub adds universal methods to RowServerStubMethods.

func RowServer

func RowServer(impl RowServerMethods) RowServerStub

RowServer returns a server stub for Row. It converts an implementation of RowServerMethods into an object that may be used by rpc.Server.

type RowServerStubMethods

type RowServerStubMethods RowServerMethods

RowServerStubMethods is the server interface containing Row methods, as expected by rpc.Server. There is no difference between this interface and RowServerMethods since there are no streaming methods.

type ScanOp

type ScanOp struct {
	// Start contains the starting key for a range scan.
	Start string
	// Limit contains the end key for a range scan.
	Limit string
}

ScanOp provides details of a scan operation.

func (ScanOp) VDLIsZero

func (x ScanOp) VDLIsZero() bool

func (*ScanOp) VDLRead

func (x *ScanOp) VDLRead(dec vdl.Decoder) error

func (ScanOp) VDLReflect

func (ScanOp) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.ScanOp"`
})

func (ScanOp) VDLWrite

func (x ScanOp) VDLWrite(enc vdl.Encoder) error

type SchemaManagerClientMethods

type SchemaManagerClientMethods interface {
	// GetSchemaMetadata retrieves schema metadata for this database.
	//
	// Requires: Read on Database.
	GetSchemaMetadata(*context.T, ...rpc.CallOpt) (SchemaMetadata, error)
	// SetSchemaMetadata stores schema metadata for this database.
	//
	// Requires: Admin on Database.
	SetSchemaMetadata(_ *context.T, metadata SchemaMetadata, _ ...rpc.CallOpt) error
}

SchemaManagerClientMethods is the client interface containing SchemaManager methods.

SchemaManager implements the API for managing schema metadata attached to a Database.

type SchemaManagerClientStub

type SchemaManagerClientStub interface {
	SchemaManagerClientMethods
	rpc.UniversalServiceMethods
}

SchemaManagerClientStub adds universal methods to SchemaManagerClientMethods.

func SchemaManagerClient

func SchemaManagerClient(name string) SchemaManagerClientStub

SchemaManagerClient returns a client stub for SchemaManager.

type SchemaManagerServerMethods

type SchemaManagerServerMethods interface {
	// GetSchemaMetadata retrieves schema metadata for this database.
	//
	// Requires: Read on Database.
	GetSchemaMetadata(*context.T, rpc.ServerCall) (SchemaMetadata, error)
	// SetSchemaMetadata stores schema metadata for this database.
	//
	// Requires: Admin on Database.
	SetSchemaMetadata(_ *context.T, _ rpc.ServerCall, metadata SchemaMetadata) error
}

SchemaManagerServerMethods is the interface a server writer implements for SchemaManager.

SchemaManager implements the API for managing schema metadata attached to a Database.

type SchemaManagerServerStub

type SchemaManagerServerStub interface {
	SchemaManagerServerStubMethods
	// Describe the SchemaManager interfaces.
	Describe__() []rpc.InterfaceDesc
}

SchemaManagerServerStub adds universal methods to SchemaManagerServerStubMethods.

func SchemaManagerServer

func SchemaManagerServer(impl SchemaManagerServerMethods) SchemaManagerServerStub

SchemaManagerServer returns a server stub for SchemaManager. It converts an implementation of SchemaManagerServerMethods into an object that may be used by rpc.Server.

type SchemaManagerServerStubMethods

type SchemaManagerServerStubMethods SchemaManagerServerMethods

SchemaManagerServerStubMethods is the server interface containing SchemaManager methods, as expected by rpc.Server. There is no difference between this interface and SchemaManagerServerMethods since there are no streaming methods.

type SchemaMetadata

type SchemaMetadata struct {
	// Non negative Schema version number. Should be increased with every schema
	// change (e.g. adding fields to structs) that cannot be handled by previous
	// versions of the app.
	// TODO(jlodhia,ivanpi): Deprecated, needs update to multiple parallel version
	// semantics.
	Version int32
	Policy  CrPolicy
}

SchemaMetadata maintains metadata related to the schema of a given database. There is one SchemaMetadata per database.

func (SchemaMetadata) VDLIsZero

func (x SchemaMetadata) VDLIsZero() bool

func (*SchemaMetadata) VDLRead

func (x *SchemaMetadata) VDLRead(dec vdl.Decoder) error

func (SchemaMetadata) VDLReflect

func (SchemaMetadata) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.SchemaMetadata"`
})

func (SchemaMetadata) VDLWrite

func (x SchemaMetadata) VDLWrite(enc vdl.Encoder) error

type ServiceClientMethods

type ServiceClientMethods interface {
	// Object provides access control for Vanadium objects.
	//
	// Vanadium services implementing dynamic access control would typically embed
	// this interface and tag additional methods defined by the service with one of
	// Admin, Read, Write, Resolve etc. For example, the VDL definition of the
	// object would be:
	//
	//   package mypackage
	//
	//   import "v.io/v23/security/access"
	//   import "v.io/v23/services/permissions"
	//
	//   type MyObject interface {
	//     permissions.Object
	//     MyRead() (string, error) {access.Read}
	//     MyWrite(string) error    {access.Write}
	//   }
	//
	// If the set of pre-defined tags is insufficient, services may define their
	// own tag type and annotate all methods with this new type.
	//
	// Instead of embedding this Object interface, define SetPermissions and
	// GetPermissions in their own interface. Authorization policies will typically
	// respect annotations of a single type. For example, the VDL definition of an
	// object would be:
	//
	//  package mypackage
	//
	//  import "v.io/v23/security/access"
	//
	//  type MyTag string
	//
	//  const (
	//    Blue = MyTag("Blue")
	//    Red  = MyTag("Red")
	//  )
	//
	//  type MyObject interface {
	//    MyMethod() (string, error) {Blue}
	//
	//    // Allow clients to change access via the access.Object interface:
	//    SetPermissions(perms access.Permissions, version string) error         {Red}
	//    GetPermissions() (perms access.Permissions, version string, err error) {Blue}
	//  }
	permissions.ObjectClientMethods
	// DevModeUpdateVClock updates various bits of Syncbase virtual clock and
	// clock daemon state based on the specified options.
	//
	// Requires: Admin on Service.
	// Also requires --dev flag to be set.
	DevModeUpdateVClock(_ *context.T, uco DevModeUpdateVClockOpts, _ ...rpc.CallOpt) error
	// DevModeGetTime returns the current time per the Syncbase clock.
	//
	// Requires: Admin on Service.
	// Also requires --dev flag to be set.
	DevModeGetTime(*context.T, ...rpc.CallOpt) (time.Time, error)
	// DevModeGetBlobShares returns the number of ownership shares held by
	// the server for the specified blob.
	//
	// Requires: Admin on Service.
	// Also requires --dev flag to be set.
	DevModeGetBlobShares(_ *context.T, br BlobRef, _ ...rpc.CallOpt) (map[string]int32, error)
}

ServiceClientMethods is the client interface containing Service methods.

Service represents a Vanadium Syncbase service. Service.Glob operates over Database ids, requiring Read on Service, returning ids sorted by blessing, then by name.

type ServiceClientStub

type ServiceClientStub interface {
	ServiceClientMethods
	rpc.UniversalServiceMethods
}

ServiceClientStub adds universal methods to ServiceClientMethods.

func ServiceClient

func ServiceClient(name string) ServiceClientStub

ServiceClient returns a client stub for Service.

type ServiceServerMethods

type ServiceServerMethods interface {
	// Object provides access control for Vanadium objects.
	//
	// Vanadium services implementing dynamic access control would typically embed
	// this interface and tag additional methods defined by the service with one of
	// Admin, Read, Write, Resolve etc. For example, the VDL definition of the
	// object would be:
	//
	//   package mypackage
	//
	//   import "v.io/v23/security/access"
	//   import "v.io/v23/services/permissions"
	//
	//   type MyObject interface {
	//     permissions.Object
	//     MyRead() (string, error) {access.Read}
	//     MyWrite(string) error    {access.Write}
	//   }
	//
	// If the set of pre-defined tags is insufficient, services may define their
	// own tag type and annotate all methods with this new type.
	//
	// Instead of embedding this Object interface, define SetPermissions and
	// GetPermissions in their own interface. Authorization policies will typically
	// respect annotations of a single type. For example, the VDL definition of an
	// object would be:
	//
	//  package mypackage
	//
	//  import "v.io/v23/security/access"
	//
	//  type MyTag string
	//
	//  const (
	//    Blue = MyTag("Blue")
	//    Red  = MyTag("Red")
	//  )
	//
	//  type MyObject interface {
	//    MyMethod() (string, error) {Blue}
	//
	//    // Allow clients to change access via the access.Object interface:
	//    SetPermissions(perms access.Permissions, version string) error         {Red}
	//    GetPermissions() (perms access.Permissions, version string, err error) {Blue}
	//  }
	permissions.ObjectServerMethods
	// DevModeUpdateVClock updates various bits of Syncbase virtual clock and
	// clock daemon state based on the specified options.
	//
	// Requires: Admin on Service.
	// Also requires --dev flag to be set.
	DevModeUpdateVClock(_ *context.T, _ rpc.ServerCall, uco DevModeUpdateVClockOpts) error
	// DevModeGetTime returns the current time per the Syncbase clock.
	//
	// Requires: Admin on Service.
	// Also requires --dev flag to be set.
	DevModeGetTime(*context.T, rpc.ServerCall) (time.Time, error)
	// DevModeGetBlobShares returns the number of ownership shares held by
	// the server for the specified blob.
	//
	// Requires: Admin on Service.
	// Also requires --dev flag to be set.
	DevModeGetBlobShares(_ *context.T, _ rpc.ServerCall, br BlobRef) (map[string]int32, error)
}

ServiceServerMethods is the interface a server writer implements for Service.

Service represents a Vanadium Syncbase service. Service.Glob operates over Database ids, requiring Read on Service, returning ids sorted by blessing, then by name.

type ServiceServerStub

type ServiceServerStub interface {
	ServiceServerStubMethods
	// Describe the Service interfaces.
	Describe__() []rpc.InterfaceDesc
}

ServiceServerStub adds universal methods to ServiceServerStubMethods.

func ServiceServer

func ServiceServer(impl ServiceServerMethods) ServiceServerStub

ServiceServer returns a server stub for Service. It converts an implementation of ServiceServerMethods into an object that may be used by rpc.Server.

type ServiceServerStubMethods

type ServiceServerStubMethods ServiceServerMethods

ServiceServerStubMethods is the server interface containing Service methods, as expected by rpc.Server. There is no difference between this interface and ServiceServerMethods since there are no streaming methods.

type StoreChange

type StoreChange struct {
	// Value is the new value for the entity if the Change state equals to Exists,
	// otherwise the Value is nil. The Value type is determined by the entity
	// type:
	// - for row updates, Value is the actual row value.
	// - for collection updates, Value is a StoreChangeCollectionInfo.
	// - for the initial root entity update, Value is nil.
	Value *vom.RawBytes
	// FromSync indicates whether the change came from sync. If FromSync is
	// false, then the change originated from the local device.
	// Note: FromSync is always false for initial state Changes.
	FromSync bool
}

StoreChange is the new value for a watched entity.

func (StoreChange) VDLIsZero

func (x StoreChange) VDLIsZero() bool

func (*StoreChange) VDLRead

func (x *StoreChange) VDLRead(dec vdl.Decoder) error

func (StoreChange) VDLReflect

func (StoreChange) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.StoreChange"`
})

func (StoreChange) VDLWrite

func (x StoreChange) VDLWrite(enc vdl.Encoder) error

type StoreChangeCollectionInfo

type StoreChangeCollectionInfo struct {
	// Allowed lists all permissions that the client has on the collection. It is
	// separate from Perms to allow clients lacking Admin permission, who are not
	// allowed to read the full Perms, to find out what permissions they have on
	// the Collection. If the client has no Read permission (Allowed does not
	// contain Read), row updates on that collection will be silently skipped.
	// TODO(ivanpi): Row updates are currently checked against the most recently
	// committed collection permissions, which may be out of sync with the last
	// seen permissions on the watch stream (that were in effect when the row was
	// written). This can result in the watch stream skipping or failing to skip
	// rows if Read access has changed. Destroying the collection may also result
	// in skipped rows since there are no permissions to check against.
	Allowed map[access.Tag]struct{}
	// Perms contains the full collection permissions only if the client has Admin
	// permissions on the collection (Allowed contains Admin). Otherwise, Perms is
	// nil.
	// TODO(ivanpi): Update when Admin tag is split into AdminRead and AdminWrite.
	Perms access.Permissions
}

StoreChangeCollectionInfo represents collection metadata in a StoreChange.

func (StoreChangeCollectionInfo) VDLIsZero

func (x StoreChangeCollectionInfo) VDLIsZero() bool

func (*StoreChangeCollectionInfo) VDLRead

func (x *StoreChangeCollectionInfo) VDLRead(dec vdl.Decoder) error

func (StoreChangeCollectionInfo) VDLReflect

func (StoreChangeCollectionInfo) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.StoreChangeCollectionInfo"`
})

func (StoreChangeCollectionInfo) VDLWrite

func (x StoreChangeCollectionInfo) VDLWrite(enc vdl.Encoder) error

type SyncgroupManagerClientMethods

type SyncgroupManagerClientMethods interface {
	// ListSyncgroups returns a list of ids of all syncgroups attached to this
	// Database. The list is sorted by blessing, then by name.
	//
	// Requires: Read on Database.
	ListSyncgroups(*context.T, ...rpc.CallOpt) ([]Id, error)
	// CreateSyncgroup creates a new syncgroup with the given spec.
	//
	// Requires: Write on Database.
	// Also requires the creator's blessing to match the pattern in the newly
	// created syncgroup's id.
	// Permissions in spec must allow the creator at least Read access.
	// All Collections in spec must exist and the creator must have Read access
	// on them.
	// For each Collection in spec that isn't already part of another syncgroup,
	// its permissions must be signed by a blessing matching the pattern in the
	// Collection id, and all data must be signed by a blessing currently allowed
	// to Write.
	// TODO(ivanpi): Since signatures are currently not enforced, we only check
	// that the Write permissions are not empty.
	CreateSyncgroup(_ *context.T, sgId Id, spec SyncgroupSpec, myInfo SyncgroupMemberInfo, _ ...rpc.CallOpt) error
	// JoinSyncgroup joins the syncgroup.
	//
	// Requires: Write on Database and Read (no Resolve required) on syncgroup.
	// For each locally existing Collection in spec, as well as each Collection
	// in spec on the remote (joinee) Syncbase, the joiner must have Read access
	// on it.
	// For each locally existing Collection in spec that isn't already part of
	// another syncgroup, its permissions must be signed by a blessing matching
	// the pattern in the Collection id, and all data must be signed by a blessing
	// currently allowed to Write.
	// TODO(ivanpi): Since signatures are currently not enforced, we only check
	// that the Write permissions are not empty.
	JoinSyncgroup(_ *context.T, remoteSyncbaseName string, expectedSyncbaseBlessings []string, sgId Id, myInfo SyncgroupMemberInfo, _ ...rpc.CallOpt) (spec SyncgroupSpec, _ error)
	// LeaveSyncgroup leaves the syncgroup. Previously synced data will continue
	// to be available. If the last syncgroup on a Collection is left, the data
	// will become read-only and the Collection must be destroyed before joining
	// a syncgroup that includes it.
	//
	// Requires: Write on Database.
	LeaveSyncgroup(_ *context.T, sgId Id, _ ...rpc.CallOpt) error
	// DestroySyncgroup destroys the syncgroup. Previously synced data will
	// continue to be available to all members, equivalent to all members
	// leaving the syncgroup.
	//
	// Requires: Write on Database and Admin (no Resolve required) on syncgroup.
	DestroySyncgroup(_ *context.T, sgId Id, _ ...rpc.CallOpt) error
	// EjectFromSyncgroup ejects a member from the syncgroup. The ejected member
	// will not be able to sync further, but will retain any data it has already
	// synced, equivalent to having left the syncgroup.
	//
	// Requires: Admin on syncgroup.
	// The caller cannot eject themselves.
	EjectFromSyncgroup(_ *context.T, sgId Id, member string, _ ...rpc.CallOpt) error
	// GetSyncgroupSpec gets the syncgroup spec. version allows for atomic
	// read-modify-write of the spec - see comment for SetSyncgroupSpec.
	//
	// Requires: Read on syncgroup.
	GetSyncgroupSpec(_ *context.T, sgId Id, _ ...rpc.CallOpt) (spec SyncgroupSpec, version string, _ error)
	// SetSyncgroupSpec sets the syncgroup spec. version may be either empty or
	// the value from a previous Get. If not empty, Set will only succeed if the
	// current version matches the specified one.
	//
	// Requires: Admin on syncgroup.
	// The caller must continue to have Read access.
	SetSyncgroupSpec(_ *context.T, sgId Id, spec SyncgroupSpec, version string, _ ...rpc.CallOpt) error
	// GetSyncgroupMembers gets the info objects for members of the syncgroup.
	//
	// Requires: Read on syncgroup.
	GetSyncgroupMembers(_ *context.T, sgId Id, _ ...rpc.CallOpt) (members map[string]SyncgroupMemberInfo, _ error)
}

SyncgroupManagerClientMethods is the client interface containing SyncgroupManager methods.

SyncgroupManager is the interface for syncgroup operations. The Database is the parent of its syncgroups for permissions checking purposes. TODO(hpucha): Add blessings to create/join and add a refresh method.

type SyncgroupManagerClientStub

type SyncgroupManagerClientStub interface {
	SyncgroupManagerClientMethods
	rpc.UniversalServiceMethods
}

SyncgroupManagerClientStub adds universal methods to SyncgroupManagerClientMethods.

func SyncgroupManagerClient

func SyncgroupManagerClient(name string) SyncgroupManagerClientStub

SyncgroupManagerClient returns a client stub for SyncgroupManager.

type SyncgroupManagerServerMethods

type SyncgroupManagerServerMethods interface {
	// ListSyncgroups returns a list of ids of all syncgroups attached to this
	// Database. The list is sorted by blessing, then by name.
	//
	// Requires: Read on Database.
	ListSyncgroups(*context.T, rpc.ServerCall) ([]Id, error)
	// CreateSyncgroup creates a new syncgroup with the given spec.
	//
	// Requires: Write on Database.
	// Also requires the creator's blessing to match the pattern in the newly
	// created syncgroup's id.
	// Permissions in spec must allow the creator at least Read access.
	// All Collections in spec must exist and the creator must have Read access
	// on them.
	// For each Collection in spec that isn't already part of another syncgroup,
	// its permissions must be signed by a blessing matching the pattern in the
	// Collection id, and all data must be signed by a blessing currently allowed
	// to Write.
	// TODO(ivanpi): Since signatures are currently not enforced, we only check
	// that the Write permissions are not empty.
	CreateSyncgroup(_ *context.T, _ rpc.ServerCall, sgId Id, spec SyncgroupSpec, myInfo SyncgroupMemberInfo) error
	// JoinSyncgroup joins the syncgroup.
	//
	// Requires: Write on Database and Read (no Resolve required) on syncgroup.
	// For each locally existing Collection in spec, as well as each Collection
	// in spec on the remote (joinee) Syncbase, the joiner must have Read access
	// on it.
	// For each locally existing Collection in spec that isn't already part of
	// another syncgroup, its permissions must be signed by a blessing matching
	// the pattern in the Collection id, and all data must be signed by a blessing
	// currently allowed to Write.
	// TODO(ivanpi): Since signatures are currently not enforced, we only check
	// that the Write permissions are not empty.
	JoinSyncgroup(_ *context.T, _ rpc.ServerCall, remoteSyncbaseName string, expectedSyncbaseBlessings []string, sgId Id, myInfo SyncgroupMemberInfo) (spec SyncgroupSpec, _ error)
	// LeaveSyncgroup leaves the syncgroup. Previously synced data will continue
	// to be available. If the last syncgroup on a Collection is left, the data
	// will become read-only and the Collection must be destroyed before joining
	// a syncgroup that includes it.
	//
	// Requires: Write on Database.
	LeaveSyncgroup(_ *context.T, _ rpc.ServerCall, sgId Id) error
	// DestroySyncgroup destroys the syncgroup. Previously synced data will
	// continue to be available to all members, equivalent to all members
	// leaving the syncgroup.
	//
	// Requires: Write on Database and Admin (no Resolve required) on syncgroup.
	DestroySyncgroup(_ *context.T, _ rpc.ServerCall, sgId Id) error
	// EjectFromSyncgroup ejects a member from the syncgroup. The ejected member
	// will not be able to sync further, but will retain any data it has already
	// synced, equivalent to having left the syncgroup.
	//
	// Requires: Admin on syncgroup.
	// The caller cannot eject themselves.
	EjectFromSyncgroup(_ *context.T, _ rpc.ServerCall, sgId Id, member string) error
	// GetSyncgroupSpec gets the syncgroup spec. version allows for atomic
	// read-modify-write of the spec - see comment for SetSyncgroupSpec.
	//
	// Requires: Read on syncgroup.
	GetSyncgroupSpec(_ *context.T, _ rpc.ServerCall, sgId Id) (spec SyncgroupSpec, version string, _ error)
	// SetSyncgroupSpec sets the syncgroup spec. version may be either empty or
	// the value from a previous Get. If not empty, Set will only succeed if the
	// current version matches the specified one.
	//
	// Requires: Admin on syncgroup.
	// The caller must continue to have Read access.
	SetSyncgroupSpec(_ *context.T, _ rpc.ServerCall, sgId Id, spec SyncgroupSpec, version string) error
	// GetSyncgroupMembers gets the info objects for members of the syncgroup.
	//
	// Requires: Read on syncgroup.
	GetSyncgroupMembers(_ *context.T, _ rpc.ServerCall, sgId Id) (members map[string]SyncgroupMemberInfo, _ error)
}

SyncgroupManagerServerMethods is the interface a server writer implements for SyncgroupManager.

SyncgroupManager is the interface for syncgroup operations. The Database is the parent of its syncgroups for permissions checking purposes. TODO(hpucha): Add blessings to create/join and add a refresh method.

type SyncgroupManagerServerStub

type SyncgroupManagerServerStub interface {
	SyncgroupManagerServerStubMethods
	// Describe the SyncgroupManager interfaces.
	Describe__() []rpc.InterfaceDesc
}

SyncgroupManagerServerStub adds universal methods to SyncgroupManagerServerStubMethods.

func SyncgroupManagerServer

func SyncgroupManagerServer(impl SyncgroupManagerServerMethods) SyncgroupManagerServerStub

SyncgroupManagerServer returns a server stub for SyncgroupManager. It converts an implementation of SyncgroupManagerServerMethods into an object that may be used by rpc.Server.

type SyncgroupManagerServerStubMethods

type SyncgroupManagerServerStubMethods SyncgroupManagerServerMethods

SyncgroupManagerServerStubMethods is the server interface containing SyncgroupManager methods, as expected by rpc.Server. There is no difference between this interface and SyncgroupManagerServerMethods since there are no streaming methods.

type SyncgroupMemberInfo

type SyncgroupMemberInfo struct {
	SyncPriority byte
	BlobDevType  byte // See BlobDevType* constants.
}

SyncgroupMemberInfo contains per-member metadata.

func (SyncgroupMemberInfo) VDLIsZero

func (x SyncgroupMemberInfo) VDLIsZero() bool

func (*SyncgroupMemberInfo) VDLRead

func (x *SyncgroupMemberInfo) VDLRead(dec vdl.Decoder) error

func (SyncgroupMemberInfo) VDLReflect

func (SyncgroupMemberInfo) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.SyncgroupMemberInfo"`
})

func (SyncgroupMemberInfo) VDLWrite

func (x SyncgroupMemberInfo) VDLWrite(enc vdl.Encoder) error

type SyncgroupSpec

type SyncgroupSpec struct {
	// Human-readable description of this syncgroup.
	Description string
	// Optional. If present, any syncbase that is the admin of this syncgroup
	// is responsible for ensuring that the syncgroup is published to this
	// syncbase instance.
	PublishSyncbaseName string
	// Permissions governing access to this syncgroup. Must include at least one
	// admin.
	Perms access.Permissions
	// Data (set of collectionIds) covered by this syncgroup.
	Collections []Id
	// Mount tables at which to advertise this syncgroup, for rendezvous purposes.
	// (Note that in addition to these mount tables, Syncbase also uses
	// network-neighborhood-based discovery for rendezvous.)
	// We expect most clients to specify a single mount table, but we accept an
	// array of mount tables to permit the mount table to be changed over time
	// without disruption.
	// TODO(hpucha): Figure out a convention for advertising syncgroups in the
	// mount table.
	MountTables []string
	// Specifies the privacy of this syncgroup. More specifically, specifies
	// whether blobs in this syncgroup can be served to clients presenting
	// blobrefs obtained from other syncgroups.
	IsPrivate bool
}

SyncgroupSpec contains the specification for a syncgroup.

func (SyncgroupSpec) VDLIsZero

func (x SyncgroupSpec) VDLIsZero() bool

func (*SyncgroupSpec) VDLRead

func (x *SyncgroupSpec) VDLRead(dec vdl.Decoder) error

func (SyncgroupSpec) VDLReflect

func (SyncgroupSpec) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.SyncgroupSpec"`
})

func (SyncgroupSpec) VDLWrite

func (x SyncgroupSpec) VDLWrite(enc vdl.Encoder) error

type Value

type Value struct {
	// State provides information about whether the field Bytes is empty or
	// not and if it is empty then why.
	State ValueState
	// VOM encoded bytes for a row's value or nil if the row was deleted.
	Bytes *vom.RawBytes
	// Write timestamp for this value
	WriteTs time.Time
}

Value contains the encoded bytes for a row's value stored in syncbase.

func (Value) VDLIsZero

func (x Value) VDLIsZero() bool

func (*Value) VDLRead

func (x *Value) VDLRead(dec vdl.Decoder) error

func (Value) VDLReflect

func (Value) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.Value"`
})

func (Value) VDLWrite

func (x Value) VDLWrite(enc vdl.Encoder) error

type ValueSelection

type ValueSelection int

ValueSelection represents the value that was selected as the final resolution for a conflict.

const (
	ValueSelectionLocal ValueSelection = iota
	ValueSelectionRemote
	ValueSelectionOther
)

func ValueSelectionFromString

func ValueSelectionFromString(label string) (x ValueSelection, err error)

ValueSelectionFromString creates a ValueSelection from a string label.

func (*ValueSelection) Set

func (x *ValueSelection) Set(label string) error

Set assigns label to x.

func (ValueSelection) String

func (x ValueSelection) String() string

String returns the string label of x.

func (ValueSelection) VDLIsZero

func (x ValueSelection) VDLIsZero() bool

func (*ValueSelection) VDLRead

func (x *ValueSelection) VDLRead(dec vdl.Decoder) error

func (ValueSelection) VDLReflect

func (ValueSelection) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.ValueSelection"`
	Enum struct{ Local, Remote, Other string }
})

func (ValueSelection) VDLWrite

func (x ValueSelection) VDLWrite(enc vdl.Encoder) error

type ValueState

type ValueState int

ValueState represents the state for Value object providing information about whether the Value object's Byte field is empty or not.

const (
	ValueStateExists ValueState = iota
	ValueStateNoExists
	ValueStateDeleted
	ValueStateUnknown
)

func ValueStateFromString

func ValueStateFromString(label string) (x ValueState, err error)

ValueStateFromString creates a ValueState from a string label.

func (*ValueState) Set

func (x *ValueState) Set(label string) error

Set assigns label to x.

func (ValueState) String

func (x ValueState) String() string

String returns the string label of x.

func (ValueState) VDLIsZero

func (x ValueState) VDLIsZero() bool

func (*ValueState) VDLRead

func (x *ValueState) VDLRead(dec vdl.Decoder) error

func (ValueState) VDLReflect

func (ValueState) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/syncbase.ValueState"`
	Enum struct{ Exists, NoExists, Deleted, Unknown string }
})

func (ValueState) VDLWrite

func (x ValueState) VDLWrite(enc vdl.Encoder) error

Jump to

Keyboard shortcuts

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