common

package
v0.0.0-...-ff5f600 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppPrefix             = "a"
	CollectionPermsPrefix = "c"
	DatabasePrefix        = "d"
	DbGCPrefix            = "g"
	DbInfoPrefix          = "i"
	LogPrefix             = "l"
	VClockPrefix          = "q"
	RowPrefix             = "r"
	ServicePrefix         = "s"
	VersionPrefix         = "v"
	SyncPrefix            = "y"

	// KeyPartSep is a separator for parts of storage engine keys, e.g. separating
	// collection id from row key.
	KeyPartSep = "\xfe"

	// PrefixRangeLimitSuffix is a key suffix that indicates the end of a prefix
	// range. Must be greater than any character allowed in client-specified keys.
	PrefixRangeLimitSuffix = "\xff"

	// AppDir is the filesystem directory that holds all app databases.
	AppDir = "apps"

	// DbDir is the filesystem directory that holds all databases for an app.
	DbDir = "dbs"
)

Constants related to storage engine keys. Note, these are persisted and therefore must not be modified.

View Source
const (
	// The pool.ntp.org project is a big virtual cluster of timeservers providing
	// reliable easy to use NTP service for millions of clients.
	// For more information, see: http://www.pool.ntp.org/en/
	NtpDefaultHost = "pool.ntp.org:123"
)

Other constants.

View Source
const (
	// Object name component for Syncbase-to-Syncbase (sync) RPCs.
	// Sync object names have the form:
	//     <syncbase>/%%sync/...
	SyncbaseSuffix = "%%sync"
)

Constants related to object names.

Variables

This section is empty.

Functions

func FirstKeyPart

func FirstKeyPart(key string) string

FirstKeyPart returns the first part of 'key', typically a key prefix defined in constants.go.

func IsRowKey

func IsRowKey(key string) bool

IsRowKey returns true iff 'key' is a storage engine key for a row.

func JoinBatchHandle

func JoinBatchHandle(batchType BatchType, batchId uint64) wire.BatchHandle

JoinBatchHandle encodes batch type and id into a BatchHandle.

func JoinKeyParts

func JoinKeyParts(parts ...string) string

JoinKeyParts builds keys for accessing data in the storage engine.

func ParseRowKey

func ParseRowKey(key string) (collection wire.Id, row string, err error)

ParseRowKey extracts collection and row parts from the given storage engine key for a data row. Returns an error if the given key is not a storage engine key for a data row.

func ParseRowKeyOrDie

func ParseRowKeyOrDie(key string) (collection wire.Id, row string)

ParseRowKeyOrDie calls ParseRowKey and panics on error.

func ScanPrefixArgs

func ScanPrefixArgs(stKeyPrefix, prefix string) ([]byte, []byte)

ScanPrefixArgs returns args for sn.Scan() for the specified prefix.

func ScanRangeArgs

func ScanRangeArgs(stKeyPrefix, start, limit string) ([]byte, []byte)

ScanRangeArgs returns args for sn.Scan() for the specified range. If limit is "", all rows with keys >= start are included.

func SplitKeyParts

func SplitKeyParts(key string) []string

SplitKeyParts is the inverse of JoinKeyParts. Clients are generally encouraged to use SplitNKeyParts.

func SplitNKeyParts

func SplitNKeyParts(key string, n int) []string

SplitNKeyParts is to SplitKeyParts as strings.SplitN is to strings.Split.

func StripFirstKeyPartOrDie

func StripFirstKeyPartOrDie(key string) string

StripFirstKeyPartOrDie strips off the first part of the given key. Typically used to strip off the key prefixes defined in constants.go. Panics if the input string has fewer than two parts.

Types

type BatchType

type BatchType byte
const (
	BatchTypeSn BatchType = 's' // snapshot
	BatchTypeTx           = 't' // transaction
)

func SplitBatchHandle

func SplitBatchHandle(bh wire.BatchHandle) (BatchType, uint64, error)

SplitBatchHandle is the inverse of JoinBatchHandle.

Jump to

Keyboard shortcuts

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