roachpb

package
v0.0.0-...-fd6f196 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2015 License: Apache-2.0 Imports: 19 Imported by: 0

README

Cockroach Protocol buffers

Hacking

Use the associated .go files to add functionality to the generated code.

Other references to Go code generation:

Documentation

Overview

Package roachpb is a generated protocol buffer package.

It is generated from these files:

cockroach/roachpb/api.proto
cockroach/roachpb/data.proto
cockroach/roachpb/errors.proto
cockroach/roachpb/internal.proto
cockroach/roachpb/metadata.proto

It has these top-level messages:

ResponseHeader
GetRequest
GetResponse
PutRequest
PutResponse
ConditionalPutRequest
ConditionalPutResponse
IncrementRequest
IncrementResponse
DeleteRequest
DeleteResponse
DeleteRangeRequest
DeleteRangeResponse
ScanRequest
ScanResponse
ReverseScanRequest
ReverseScanResponse
BeginTransactionRequest
BeginTransactionResponse
EndTransactionRequest
EndTransactionResponse
AdminSplitRequest
AdminSplitResponse
AdminMergeRequest
AdminMergeResponse
RangeLookupRequest
RangeLookupResponse
HeartbeatTxnRequest
HeartbeatTxnResponse
GCRequest
GCResponse
PushTxnRequest
PushTxnResponse
ResolveIntentRequest
ResolveIntentResponse
ResolveIntentRangeRequest
NoopResponse
NoopRequest
ResolveIntentRangeResponse
MergeRequest
MergeResponse
TruncateLogRequest
TruncateLogResponse
LeaderLeaseRequest
LeaderLeaseResponse
RequestUnion
ResponseUnion
Header
BatchRequest
BatchResponse
Span
Timestamp
Value
KeyValue
StoreIdent
SplitTrigger
MergeTrigger
ChangeReplicasTrigger
ModifiedSpanTrigger
InternalCommitTrigger
NodeList
Transaction
Intent
Lease
GCMetadata
SequenceCacheEntry
NotLeaderError
NodeUnavailableError
RangeNotFoundError
RangeKeyMismatchError
ReadWithinUncertaintyIntervalError
TransactionAbortedError
TransactionPushError
TransactionRetryError
TransactionStatusError
WriteIntentError
WriteTooOldError
OpRequiresTxnError
ConditionFailedError
LeaseRejectedError
SendError
ErrorDetail
ErrPosition
Error
RaftCommand
InternalTimeSeriesData
InternalTimeSeriesSample
RaftTruncatedState
RaftTombstone
RaftSnapshotData
Attributes
ReplicaDescriptor
RangeDescriptor
RangeTree
RangeTreeNode
StoreCapacity
NodeDescriptor
StoreDescriptor

Index

Constants

View Source
const (
	// MaxPriority is the maximum allowed priority.
	MaxPriority = math.MaxInt32
	// TransactionIDLen is the length (in bytes) of the transaction IDs used.
	TransactionIDLen = 16
)
View Source
const Default_Header_UserPriority int32 = 1

Variables

View Source
var (
	ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowApi   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	// RKeyMin is a minimum key value which sorts before all other keys.
	RKeyMin = RKey("")
	// KeyMin is a minimum key value which sorts before all other keys.
	KeyMin = Key(RKeyMin)
	// RKeyMax is a maximum key value which sorts after all other keys.
	RKeyMax = RKey{0xff, 0xff}
	// KeyMax is a maximum key value which sorts after all other keys.
	KeyMax = Key(RKeyMax)
)
View Source
var (
	// MaxTimestamp is the max value allowed for Timestamp.
	MaxTimestamp = Timestamp{WallTime: math.MaxInt64, Logical: math.MaxInt32}
	// MinTimestamp is the min value allowed for Timestamp.
	MinTimestamp = Timestamp{WallTime: 0, Logical: 1}
	// ZeroTimestamp is an empty timestamp.
	ZeroTimestamp = Timestamp{WallTime: 0, Logical: 0}
)

Timestamp constant values.

View Source
var (
	ErrInvalidLengthData = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowData   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthErrors = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowErrors   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthInternal = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowInternal   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthMetadata = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMetadata   = fmt.Errorf("proto: integer overflow")
)
View Source
var IsolationType_name = map[int32]string{
	0: "SERIALIZABLE",
	1: "SNAPSHOT",
}
View Source
var IsolationType_value = map[string]int32{
	"SERIALIZABLE": 0,
	"SNAPSHOT":     1,
}
View Source
var PushTxnType_name = map[int32]string{
	0: "PUSH_TIMESTAMP",
	1: "ABORT_TXN",
	2: "CLEANUP_TXN",
}
View Source
var PushTxnType_value = map[string]int32{
	"PUSH_TIMESTAMP": 0,
	"ABORT_TXN":      1,
	"CLEANUP_TXN":    2,
}
View Source
var ReadConsistencyType_name = map[int32]string{
	0: "CONSISTENT",
	1: "CONSENSUS",
	2: "INCONSISTENT",
}
View Source
var ReadConsistencyType_value = map[string]int32{
	"CONSISTENT":   0,
	"CONSENSUS":    1,
	"INCONSISTENT": 2,
}
View Source
var ReplicaChangeType_name = map[int32]string{
	0: "ADD_REPLICA",
	1: "REMOVE_REPLICA",
}
View Source
var ReplicaChangeType_value = map[string]int32{
	"ADD_REPLICA":    0,
	"REMOVE_REPLICA": 1,
}
View Source
var TransactionRestart_name = map[int32]string{
	0: "ABORT",
	1: "BACKOFF",
	2: "IMMEDIATE",
}
View Source
var TransactionRestart_value = map[string]int32{
	"ABORT":     0,
	"BACKOFF":   1,
	"IMMEDIATE": 2,
}
View Source
var TransactionStatus_name = map[int32]string{
	0: "PENDING",
	1: "COMMITTED",
	2: "ABORTED",
}
View Source
var TransactionStatus_value = map[string]int32{
	"PENDING":   0,
	"COMMITTED": 1,
	"ABORTED":   2,
}
View Source
var ValueType_name = map[int32]string{
	0:   "UNKNOWN",
	1:   "INT",
	2:   "FLOAT",
	3:   "BYTES",
	4:   "TIME",
	100: "TIMESERIES",
}
View Source
var ValueType_value = map[string]int32{
	"UNKNOWN":    0,
	"INT":        1,
	"FLOAT":      2,
	"BYTES":      3,
	"TIME":       4,
	"TIMESERIES": 100,
}

Functions

func BytesNext

func BytesNext(b []byte) []byte

BytesNext returns the next possible byte by appending an \x00.

func ErrorUnexpectedlySet

func ErrorUnexpectedlySet(culprit, response interface{}) string

ErrorUnexpectedlySet creates a string to panic with when a response (typically a roachpb.BatchResponse) unexpectedly has Error set in its response header.

func IsRange

func IsRange(args Request) bool

IsRange returns true if the operation is range-based and must include a start and an end key.

func IsReadOnly

func IsReadOnly(args Request) bool

IsReadOnly returns true iff the request is read-only.

func IsTransactionWrite

func IsTransactionWrite(args Request) bool

IsTransactionWrite returns true if the request produces write intents when used within a transaction.

func MakeKey

func MakeKey(keys ...[]byte) []byte

MakeKey makes a new key which is the concatenation of the given inputs, in order.

func MakePriority

func MakePriority(userPriority int32) int32

MakePriority generates a random priority value, biased by the specified userPriority. If userPriority=100, the resulting priority is 100x more likely to be probabilistically greater than a similar invocation with userPriority=1.

func TxnIDEqual

func TxnIDEqual(a, b []byte) bool

TxnIDEqual returns whether the transaction IDs are equal.

Types

type AdminMergeRequest

type AdminMergeRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

An AdminMergeRequest is the argument to the AdminMerge() method. A merge is performed by calling AdminMerge on the left-hand range of two consecutive ranges (i.e. the range which contains keys which sort first). This range will be the subsuming range and the right hand range will be subsumed. After the merge operation, the subsumed range will no longer exist and the subsuming range will now encompass all keys from its original start key to the end key of the subsumed range. If AdminMerge is called on the final range in the key space, it is a noop.

func (*AdminMergeRequest) CreateReply

func (*AdminMergeRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*AdminMergeRequest) Marshal

func (m *AdminMergeRequest) Marshal() (data []byte, err error)

func (*AdminMergeRequest) MarshalTo

func (m *AdminMergeRequest) MarshalTo(data []byte) (int, error)

func (*AdminMergeRequest) Method

func (*AdminMergeRequest) Method() Method

Method implements the Request interface.

func (*AdminMergeRequest) ProtoMessage

func (*AdminMergeRequest) ProtoMessage()

func (*AdminMergeRequest) Reset

func (m *AdminMergeRequest) Reset()

func (*AdminMergeRequest) Size

func (m *AdminMergeRequest) Size() (n int)

func (*AdminMergeRequest) String

func (m *AdminMergeRequest) String() string

func (*AdminMergeRequest) Unmarshal

func (m *AdminMergeRequest) Unmarshal(data []byte) error

type AdminMergeResponse

type AdminMergeResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

An AdminMergeResponse is the return value from the AdminMerge() method.

func (*AdminMergeResponse) Marshal

func (m *AdminMergeResponse) Marshal() (data []byte, err error)

func (*AdminMergeResponse) MarshalTo

func (m *AdminMergeResponse) MarshalTo(data []byte) (int, error)

func (*AdminMergeResponse) ProtoMessage

func (*AdminMergeResponse) ProtoMessage()

func (*AdminMergeResponse) Reset

func (m *AdminMergeResponse) Reset()

func (*AdminMergeResponse) Size

func (m *AdminMergeResponse) Size() (n int)

func (*AdminMergeResponse) String

func (m *AdminMergeResponse) String() string

func (*AdminMergeResponse) Unmarshal

func (m *AdminMergeResponse) Unmarshal(data []byte) error

type AdminSplitRequest

type AdminSplitRequest struct {
	Span     `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	SplitKey Key `protobuf:"bytes,2,opt,name=split_key,casttype=Key" json:"split_key,omitempty"`
}

An AdminSplitRequest is the argument to the AdminSplit() method. The existing range which contains header.key is split by split_key. If split_key is not specified, then this method will determine a split key that is roughly halfway through the range. The existing range is resized to cover only its start key to the split key. The new range created by the split starts at the split key and extends to the original range's end key. If split_key is known, header.key should also be set to split_key.

New range IDs for each of the split range's replica and a new Raft ID are generated by the operation. Split requests are done in the context of a distributed transaction which updates range addressing records, range metadata and finally, provides a commit trigger to update bookkeeping and instantiate the new range on commit.

The new range contains range replicas located on the same stores; no range data is moved during this operation. The split can be thought of as a mostly logical operation, though some other metadata (e.g. sequence cache and range stats must be copied or recomputed).

func (*AdminSplitRequest) CreateReply

func (*AdminSplitRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*AdminSplitRequest) Marshal

func (m *AdminSplitRequest) Marshal() (data []byte, err error)

func (*AdminSplitRequest) MarshalTo

func (m *AdminSplitRequest) MarshalTo(data []byte) (int, error)

func (*AdminSplitRequest) Method

func (*AdminSplitRequest) Method() Method

Method implements the Request interface.

func (*AdminSplitRequest) ProtoMessage

func (*AdminSplitRequest) ProtoMessage()

func (*AdminSplitRequest) Reset

func (m *AdminSplitRequest) Reset()

func (*AdminSplitRequest) Size

func (m *AdminSplitRequest) Size() (n int)

func (*AdminSplitRequest) String

func (m *AdminSplitRequest) String() string

func (*AdminSplitRequest) Unmarshal

func (m *AdminSplitRequest) Unmarshal(data []byte) error

type AdminSplitResponse

type AdminSplitResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

An AdminSplitResponse is the return value from the AdminSplit() method.

func (*AdminSplitResponse) Marshal

func (m *AdminSplitResponse) Marshal() (data []byte, err error)

func (*AdminSplitResponse) MarshalTo

func (m *AdminSplitResponse) MarshalTo(data []byte) (int, error)

func (*AdminSplitResponse) ProtoMessage

func (*AdminSplitResponse) ProtoMessage()

func (*AdminSplitResponse) Reset

func (m *AdminSplitResponse) Reset()

func (*AdminSplitResponse) Size

func (m *AdminSplitResponse) Size() (n int)

func (*AdminSplitResponse) String

func (m *AdminSplitResponse) String() string

func (*AdminSplitResponse) Unmarshal

func (m *AdminSplitResponse) Unmarshal(data []byte) error

type Attributes

type Attributes struct {
	Attrs []string `protobuf:"bytes,1,rep,name=attrs" json:"attrs,omitempty" yaml:"attrs,flow"`
}

Attributes specifies a list of arbitrary strings describing node topology, store type, and machine capabilities.

func (Attributes) IsSubset

func (a Attributes) IsSubset(b Attributes) bool

IsSubset returns whether attributes list a is a subset of attributes list b.

func (*Attributes) Marshal

func (m *Attributes) Marshal() (data []byte, err error)

func (*Attributes) MarshalTo

func (m *Attributes) MarshalTo(data []byte) (int, error)

func (*Attributes) ProtoMessage

func (*Attributes) ProtoMessage()

func (*Attributes) Reset

func (m *Attributes) Reset()

func (*Attributes) Size

func (m *Attributes) Size() (n int)

func (Attributes) SortedString

func (a Attributes) SortedString() string

SortedString returns a sorted, de-duplicated, comma-separated list of the attributes.

func (Attributes) String

func (a Attributes) String() string

func (*Attributes) Unmarshal

func (m *Attributes) Unmarshal(data []byte) error

type BatchRequest

type BatchRequest struct {
	Header   `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Requests []RequestUnion `protobuf:"bytes,2,rep,name=requests" json:"requests"`
}

A BatchRequest contains one or more requests to be executed in parallel, or if applicable (based on write-only commands and range-locality), as a single update.

The Span should contain the Key of the first request in the batch. It also contains the transaction itself; individual calls must not have transactions specified. The same applies to the User and UserPriority fields.

func (*BatchRequest) Add

func (ba *BatchRequest) Add(requests ...Request)

Add adds a request to the batch request.

func (*BatchRequest) CreateReply

func (ba *BatchRequest) CreateReply() *BatchResponse

CreateReply implements the Request interface. It's slightly different from the other implementations: It creates replies for each of the contained requests, wrapped in a BatchResponse.

func (*BatchRequest) GetArg

func (ba *BatchRequest) GetArg(method Method) (Request, bool)

GetArg returns the first request of the given type, if possible.

func (*BatchRequest) GetIntentSpans

func (ba *BatchRequest) GetIntentSpans() []Span

GetIntentSpans returns a slice of key pairs corresponding to transactional writes contained in the batch.

func (*BatchRequest) GetUser

func (*BatchRequest) GetUser() string

GetUser implements security.RequestWithUser. KV messages are always sent by the node user.

func (*BatchRequest) IsAdmin

func (ba *BatchRequest) IsAdmin() bool

IsAdmin returns true iff the BatchRequest contains an admin request.

func (*BatchRequest) IsPossibleTransaction

func (ba *BatchRequest) IsPossibleTransaction() bool

IsPossibleTransaction returns true iff the BatchRequest contains requests that can be part of a transaction.

func (*BatchRequest) IsRange

func (ba *BatchRequest) IsRange() bool

IsRange returns true iff the BatchRequest contains a range request.

func (*BatchRequest) IsReadOnly

func (ba *BatchRequest) IsReadOnly() bool

IsReadOnly returns true if all requests within are read-only.

func (*BatchRequest) IsReverse

func (ba *BatchRequest) IsReverse() bool

IsReverse returns true iff the BatchRequest contains a reverse request.

func (*BatchRequest) IsTransactionWrite

func (ba *BatchRequest) IsTransactionWrite() bool

IsTransactionWrite returns true iff the BatchRequest contains a txn write.

func (*BatchRequest) IsWrite

func (ba *BatchRequest) IsWrite() bool

IsWrite returns true iff the BatchRequest contains a write.

func (*BatchRequest) Marshal

func (m *BatchRequest) Marshal() (data []byte, err error)

func (*BatchRequest) MarshalTo

func (m *BatchRequest) MarshalTo(data []byte) (int, error)

func (*BatchRequest) Methods

func (ba *BatchRequest) Methods() []Method

Methods returns a slice of the contained methods.

func (*BatchRequest) ProtoMessage

func (*BatchRequest) ProtoMessage()

func (*BatchRequest) Reset

func (m *BatchRequest) Reset()

func (*BatchRequest) SetNewRequest

func (ba *BatchRequest) SetNewRequest()

SetNewRequest increases the internal sequence counter of this batch request. The sequence counter is used for replay and reordering protection. At the Store, a sequence counter less than or equal to the last observed one incurs a transaction restart (if the request is transactional).

func (BatchRequest) Short

func (ba BatchRequest) Short() string

Short gives gives a short version of the batch, printing the flags and timestamp only.

func (*BatchRequest) Size

func (m *BatchRequest) Size() (n int)

func (BatchRequest) Split

func (ba BatchRequest) Split() [][]RequestUnion

Split separates the requests contained in a batch so that each subset of requests can be executed by a Store (without changing order). In particular, Admin and EndTransaction requests are always singled out and mutating requests separated from reads.

func (BatchRequest) String

func (ba BatchRequest) String() string

String gives a brief summary of the contained requests and keys in the batch. TODO(tschottdorf): the key range is useful information, but requires `keys`. See #2198.

func (BatchRequest) TraceID

func (ba BatchRequest) TraceID() string

TraceID implements tracer.Traceable by returning the TraceID of the Transaction or, if not transactional, a digest of the batch.

func (BatchRequest) TraceName

func (ba BatchRequest) TraceName() string

TraceName implements tracer.Traceable and behaves like TraceID, but using the TraceName of the object delegated to.

func (*BatchRequest) Unmarshal

func (m *BatchRequest) Unmarshal(data []byte) error

type BatchResponse

type BatchResponse struct {
	BatchResponse_Header `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Responses            []ResponseUnion `protobuf:"bytes,2,rep,name=responses" json:"responses"`
}

A BatchResponse contains one or more responses, one per request corresponding to the requests in the matching BatchRequest. The error in the response header is set to the first error from the slice of responses, if applicable.

func (*BatchResponse) Add

func (br *BatchResponse) Add(reply Response)

Add adds a response to the batch response.

func (*BatchResponse) Combine

func (br *BatchResponse) Combine(otherBatch *BatchResponse) error

Combine implements the Combinable interface. It combines each slot of the given request into the corresponding slot of the base response. The number of slots must be equal and the respective slots must be combinable. On error, the receiver BatchResponse is in an invalid state. TODO(tschottdorf): write tests.

func (*BatchResponse) First

func (br *BatchResponse) First() Response

First returns the first response of the given type, if possible.

func (*BatchResponse) GoError

func (br *BatchResponse) GoError() error

GoError returns the non-nil error from the proto.Error union.

func (*BatchResponse) Header

func (br *BatchResponse) Header() *BatchResponse_Header

Header returns a pointer to the header.

func (*BatchResponse) Marshal

func (m *BatchResponse) Marshal() (data []byte, err error)

func (*BatchResponse) MarshalTo

func (m *BatchResponse) MarshalTo(data []byte) (int, error)

func (*BatchResponse) ProtoMessage

func (*BatchResponse) ProtoMessage()

func (*BatchResponse) Reset

func (m *BatchResponse) Reset()

func (*BatchResponse) ResetAll

func (br *BatchResponse) ResetAll()

ResetAll resets all the contained requests to their original state.

func (*BatchResponse) SetGoError

func (br *BatchResponse) SetGoError(err error)

SetGoError converts the specified type into either one of the proto- defined error types or into an Error for all other Go errors.

func (*BatchResponse) Size

func (m *BatchResponse) Size() (n int)

func (*BatchResponse) String

func (br *BatchResponse) String() string

func (*BatchResponse) Unmarshal

func (m *BatchResponse) Unmarshal(data []byte) error

type BatchResponse_Header

type BatchResponse_Header struct {
	// error is non-nil if an error occurred.
	Error *Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
	// timestamp specifies time at which read or write actually was
	// performed. In the case of both reads and writes, if the timestamp
	// supplied to the request was 0, the wall time of the node
	// servicing the request will be set here. Additionally, in the case
	// of writes, this value may be increased from the timestamp passed
	// with the Span if the key being written was either read
	// or written more recently.
	Timestamp Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp"`
	// txn is non-nil if the request specified a non-nil
	// transaction. The transaction timestamp and/or priority may have
	// been updated, depending on the outcome of the request.
	Txn *Transaction `protobuf:"bytes,3,opt,name=txn" json:"txn,omitempty"`
}

func (*BatchResponse_Header) Marshal

func (m *BatchResponse_Header) Marshal() (data []byte, err error)

func (*BatchResponse_Header) MarshalTo

func (m *BatchResponse_Header) MarshalTo(data []byte) (int, error)

func (*BatchResponse_Header) ProtoMessage

func (*BatchResponse_Header) ProtoMessage()

func (*BatchResponse_Header) Reset

func (m *BatchResponse_Header) Reset()

func (*BatchResponse_Header) Size

func (m *BatchResponse_Header) Size() (n int)

func (*BatchResponse_Header) String

func (m *BatchResponse_Header) String() string

func (*BatchResponse_Header) Unmarshal

func (m *BatchResponse_Header) Unmarshal(data []byte) error

type BeginTransactionRequest

type BeginTransactionRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A BeginTransactionRequest is the argument to the BeginTransaction() method.

func (*BeginTransactionRequest) CreateReply

func (*BeginTransactionRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*BeginTransactionRequest) Marshal

func (m *BeginTransactionRequest) Marshal() (data []byte, err error)

func (*BeginTransactionRequest) MarshalTo

func (m *BeginTransactionRequest) MarshalTo(data []byte) (int, error)

func (*BeginTransactionRequest) Method

func (*BeginTransactionRequest) Method() Method

Method implements the Request interface.

func (*BeginTransactionRequest) ProtoMessage

func (*BeginTransactionRequest) ProtoMessage()

func (*BeginTransactionRequest) Reset

func (m *BeginTransactionRequest) Reset()

func (*BeginTransactionRequest) Size

func (m *BeginTransactionRequest) Size() (n int)

func (*BeginTransactionRequest) String

func (m *BeginTransactionRequest) String() string

func (*BeginTransactionRequest) Unmarshal

func (m *BeginTransactionRequest) Unmarshal(data []byte) error

type BeginTransactionResponse

type BeginTransactionResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A BeginTransactionResponse is the return value from the BeginTransaction() method.

func (*BeginTransactionResponse) Marshal

func (m *BeginTransactionResponse) Marshal() (data []byte, err error)

func (*BeginTransactionResponse) MarshalTo

func (m *BeginTransactionResponse) MarshalTo(data []byte) (int, error)

func (*BeginTransactionResponse) ProtoMessage

func (*BeginTransactionResponse) ProtoMessage()

func (*BeginTransactionResponse) Reset

func (m *BeginTransactionResponse) Reset()

func (*BeginTransactionResponse) Size

func (m *BeginTransactionResponse) Size() (n int)

func (*BeginTransactionResponse) String

func (m *BeginTransactionResponse) String() string

func (*BeginTransactionResponse) Unmarshal

func (m *BeginTransactionResponse) Unmarshal(data []byte) error

type Bounded

type Bounded interface {
	GetBound() int64
	SetBound(bound int64)
}

Bounded is implemented by request types which have a bounded number of result rows, such as Scan.

type ChangeReplicasTrigger

type ChangeReplicasTrigger struct {
	ChangeType ReplicaChangeType `protobuf:"varint,1,opt,name=change_type,enum=cockroach.roachpb.ReplicaChangeType" json:"change_type"`
	// The replica being modified.
	Replica ReplicaDescriptor `protobuf:"bytes,2,opt,name=replica" json:"replica"`
	// The new replica list with this change applied.
	UpdatedReplicas []ReplicaDescriptor `protobuf:"bytes,3,rep,name=updated_replicas" json:"updated_replicas"`
	NextReplicaID   ReplicaID           `protobuf:"varint,4,opt,name=next_replica_id,casttype=ReplicaID" json:"next_replica_id"`
}

func (*ChangeReplicasTrigger) Marshal

func (m *ChangeReplicasTrigger) Marshal() (data []byte, err error)

func (*ChangeReplicasTrigger) MarshalTo

func (m *ChangeReplicasTrigger) MarshalTo(data []byte) (int, error)

func (*ChangeReplicasTrigger) ProtoMessage

func (*ChangeReplicasTrigger) ProtoMessage()

func (*ChangeReplicasTrigger) Reset

func (m *ChangeReplicasTrigger) Reset()

func (*ChangeReplicasTrigger) Size

func (m *ChangeReplicasTrigger) Size() (n int)

func (*ChangeReplicasTrigger) String

func (m *ChangeReplicasTrigger) String() string

func (*ChangeReplicasTrigger) Unmarshal

func (m *ChangeReplicasTrigger) Unmarshal(data []byte) error

type Combinable

type Combinable interface {
	Combine(Response) error
}

Combinable is implemented by response types whose corresponding requests may cross range boundaries, such as Scan or DeleteRange. Combine() allows responses from individual ranges to be aggregated into a single one.

type ConditionFailedError

type ConditionFailedError struct {
	ActualValue *Value       `protobuf:"bytes,1,opt,name=actual_value" json:"actual_value,omitempty"`
	Index       *ErrPosition `protobuf:"bytes,2,opt,name=index" json:"index,omitempty"`
}

A ConditionFailedError indicates that the expected value of a ConditionalPutRequest was not found, either because it was missing or was not equal. The error will contain the actual value found.

func (*ConditionFailedError) Error

func (e *ConditionFailedError) Error() string

Error formats error.

func (*ConditionFailedError) ErrorIndex

func (e *ConditionFailedError) ErrorIndex() (int32, bool)

ErrorIndex implements IndexedError.

func (*ConditionFailedError) Marshal

func (m *ConditionFailedError) Marshal() (data []byte, err error)

func (*ConditionFailedError) MarshalTo

func (m *ConditionFailedError) MarshalTo(data []byte) (int, error)

func (*ConditionFailedError) ProtoMessage

func (*ConditionFailedError) ProtoMessage()

func (*ConditionFailedError) Reset

func (m *ConditionFailedError) Reset()

func (*ConditionFailedError) SetErrorIndex

func (e *ConditionFailedError) SetErrorIndex(index int32)

SetErrorIndex implements IndexedError.

func (*ConditionFailedError) Size

func (m *ConditionFailedError) Size() (n int)

func (*ConditionFailedError) Unmarshal

func (m *ConditionFailedError) Unmarshal(data []byte) error

type ConditionalPutRequest

type ConditionalPutRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// The value to put.
	Value Value `protobuf:"bytes,2,opt,name=value" json:"value"`
	// Set exp_value.bytes empty to test for non-existence. Specify as nil
	// to indicate there should be no existing entry. This is different
	// from the expectation that the value exists but is empty.
	ExpValue *Value `protobuf:"bytes,3,opt,name=exp_value" json:"exp_value,omitempty"`
}

A ConditionalPutRequest is the argument to the ConditionalPut() method.

- Returns true and sets value if exp_value equals existing value. - If key doesn't exist and exp_value is nil, sets value. - If key exists, but value is empty and exp_value is not nil but empty, sets value. - Otherwise, returns error and the actual value of the key in the response.

func (*ConditionalPutRequest) CreateReply

func (*ConditionalPutRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*ConditionalPutRequest) Marshal

func (m *ConditionalPutRequest) Marshal() (data []byte, err error)

func (*ConditionalPutRequest) MarshalTo

func (m *ConditionalPutRequest) MarshalTo(data []byte) (int, error)

func (*ConditionalPutRequest) Method

func (*ConditionalPutRequest) Method() Method

Method implements the Request interface.

func (*ConditionalPutRequest) ProtoMessage

func (*ConditionalPutRequest) ProtoMessage()

func (*ConditionalPutRequest) Reset

func (m *ConditionalPutRequest) Reset()

func (*ConditionalPutRequest) Size

func (m *ConditionalPutRequest) Size() (n int)

func (*ConditionalPutRequest) String

func (m *ConditionalPutRequest) String() string

func (*ConditionalPutRequest) Unmarshal

func (m *ConditionalPutRequest) Unmarshal(data []byte) error

type ConditionalPutResponse

type ConditionalPutResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A ConditionalPutResponse is the return value from the ConditionalPut() method.

func (*ConditionalPutResponse) Marshal

func (m *ConditionalPutResponse) Marshal() (data []byte, err error)

func (*ConditionalPutResponse) MarshalTo

func (m *ConditionalPutResponse) MarshalTo(data []byte) (int, error)

func (*ConditionalPutResponse) ProtoMessage

func (*ConditionalPutResponse) ProtoMessage()

func (*ConditionalPutResponse) Reset

func (m *ConditionalPutResponse) Reset()

func (*ConditionalPutResponse) Size

func (m *ConditionalPutResponse) Size() (n int)

func (*ConditionalPutResponse) String

func (m *ConditionalPutResponse) String() string

func (*ConditionalPutResponse) Unmarshal

func (m *ConditionalPutResponse) Unmarshal(data []byte) error

type Countable

type Countable interface {
	Count() int64
}

Countable is implemented by response types which have a number of result rows, such as Scan.

type DeleteRangeRequest

type DeleteRangeRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// If 0, *all* entries between key (inclusive) and end_key
	// (exclusive) are deleted. Must be >= 0.
	MaxEntriesToDelete int64 `protobuf:"varint,2,opt,name=max_entries_to_delete" json:"max_entries_to_delete"`
}

A DeleteRangeRequest is the argument to the DeleteRange() method. It specifies the range of keys to delete.

func (*DeleteRangeRequest) CreateReply

func (*DeleteRangeRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*DeleteRangeRequest) Marshal

func (m *DeleteRangeRequest) Marshal() (data []byte, err error)

func (*DeleteRangeRequest) MarshalTo

func (m *DeleteRangeRequest) MarshalTo(data []byte) (int, error)

func (*DeleteRangeRequest) Method

func (*DeleteRangeRequest) Method() Method

Method implements the Request interface.

func (*DeleteRangeRequest) ProtoMessage

func (*DeleteRangeRequest) ProtoMessage()

func (*DeleteRangeRequest) Reset

func (m *DeleteRangeRequest) Reset()

func (*DeleteRangeRequest) Size

func (m *DeleteRangeRequest) Size() (n int)

func (*DeleteRangeRequest) String

func (m *DeleteRangeRequest) String() string

func (*DeleteRangeRequest) Unmarshal

func (m *DeleteRangeRequest) Unmarshal(data []byte) error

type DeleteRangeResponse

type DeleteRangeResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// Number of entries removed.
	NumDeleted int64 `protobuf:"varint,2,opt,name=num_deleted" json:"num_deleted"`
}

A DeleteRangeResponse is the return value from the DeleteRange() method.

func (*DeleteRangeResponse) Combine

func (dr *DeleteRangeResponse) Combine(c Response) error

Combine implements the Combinable interface.

func (*DeleteRangeResponse) Marshal

func (m *DeleteRangeResponse) Marshal() (data []byte, err error)

func (*DeleteRangeResponse) MarshalTo

func (m *DeleteRangeResponse) MarshalTo(data []byte) (int, error)

func (*DeleteRangeResponse) ProtoMessage

func (*DeleteRangeResponse) ProtoMessage()

func (*DeleteRangeResponse) Reset

func (m *DeleteRangeResponse) Reset()

func (*DeleteRangeResponse) Size

func (m *DeleteRangeResponse) Size() (n int)

func (*DeleteRangeResponse) String

func (m *DeleteRangeResponse) String() string

func (*DeleteRangeResponse) Unmarshal

func (m *DeleteRangeResponse) Unmarshal(data []byte) error

type DeleteRequest

type DeleteRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A DeleteRequest is the argument to the Delete() method.

func (*DeleteRequest) CreateReply

func (*DeleteRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*DeleteRequest) Marshal

func (m *DeleteRequest) Marshal() (data []byte, err error)

func (*DeleteRequest) MarshalTo

func (m *DeleteRequest) MarshalTo(data []byte) (int, error)

func (*DeleteRequest) Method

func (*DeleteRequest) Method() Method

Method implements the Request interface.

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) Reset

func (m *DeleteRequest) Reset()

func (*DeleteRequest) Size

func (m *DeleteRequest) Size() (n int)

func (*DeleteRequest) String

func (m *DeleteRequest) String() string

func (*DeleteRequest) Unmarshal

func (m *DeleteRequest) Unmarshal(data []byte) error

type DeleteResponse

type DeleteResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A DeleteResponse is the return value from the Delete() method.

func (*DeleteResponse) Marshal

func (m *DeleteResponse) Marshal() (data []byte, err error)

func (*DeleteResponse) MarshalTo

func (m *DeleteResponse) MarshalTo(data []byte) (int, error)

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) Reset

func (m *DeleteResponse) Reset()

func (*DeleteResponse) Size

func (m *DeleteResponse) Size() (n int)

func (*DeleteResponse) String

func (m *DeleteResponse) String() string

func (*DeleteResponse) Unmarshal

func (m *DeleteResponse) Unmarshal(data []byte) error

type EndTransactionRequest

type EndTransactionRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// False to abort and rollback.
	Commit bool `protobuf:"varint,2,opt,name=commit" json:"commit"`
	// Optional commit triggers. Note that commit triggers are for
	// internal use only and will cause an error if requested through the
	// external-facing KV API.
	// The deadline by which the transaction must commit, if present.
	Deadline              *Timestamp             `protobuf:"bytes,3,opt,name=deadline" json:"deadline,omitempty"`
	InternalCommitTrigger *InternalCommitTrigger `protobuf:"bytes,4,opt,name=internal_commit_trigger" json:"internal_commit_trigger,omitempty"`
	// List of intents written by the transaction.
	IntentSpans []Span `protobuf:"bytes,5,rep,name=intent_spans" json:"intent_spans"`
}

An EndTransactionRequest is the argument to the EndTransaction() method. It specifies whether to commit or roll back an extant transaction.

func (*EndTransactionRequest) CreateReply

func (*EndTransactionRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*EndTransactionRequest) Marshal

func (m *EndTransactionRequest) Marshal() (data []byte, err error)

func (*EndTransactionRequest) MarshalTo

func (m *EndTransactionRequest) MarshalTo(data []byte) (int, error)

func (*EndTransactionRequest) Method

func (*EndTransactionRequest) Method() Method

Method implements the Request interface.

func (*EndTransactionRequest) ProtoMessage

func (*EndTransactionRequest) ProtoMessage()

func (*EndTransactionRequest) Reset

func (m *EndTransactionRequest) Reset()

func (*EndTransactionRequest) Size

func (m *EndTransactionRequest) Size() (n int)

func (*EndTransactionRequest) String

func (m *EndTransactionRequest) String() string

func (*EndTransactionRequest) Unmarshal

func (m *EndTransactionRequest) Unmarshal(data []byte) error

type EndTransactionResponse

type EndTransactionResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// Remaining time (ns).
	CommitWait int64 `protobuf:"varint,2,opt,name=commit_wait" json:"commit_wait"`
	// List of intents resolved by EndTransaction call.
	Resolved []Key `protobuf:"bytes,3,rep,name=resolved,casttype=Key" json:"resolved,omitempty"`
}

An EndTransactionResponse is the return value from the EndTransaction() method. The final transaction record is returned as part of the response header. In particular, transaction status and timestamp will be updated to reflect final committed values. Clients may propagate the transaction timestamp as the final txn commit timestamp in order to preserve causal ordering between subsequent transactions. CommitWait specifies the commit wait, which is the remaining time the client MUST wait before signalling completion of the transaction to another distributed node to maintain consistency.

func (*EndTransactionResponse) Marshal

func (m *EndTransactionResponse) Marshal() (data []byte, err error)

func (*EndTransactionResponse) MarshalTo

func (m *EndTransactionResponse) MarshalTo(data []byte) (int, error)

func (*EndTransactionResponse) ProtoMessage

func (*EndTransactionResponse) ProtoMessage()

func (*EndTransactionResponse) Reset

func (m *EndTransactionResponse) Reset()

func (*EndTransactionResponse) Size

func (m *EndTransactionResponse) Size() (n int)

func (*EndTransactionResponse) String

func (m *EndTransactionResponse) String() string

func (*EndTransactionResponse) Unmarshal

func (m *EndTransactionResponse) Unmarshal(data []byte) error

type ErrPosition

type ErrPosition struct {
	Index int32 `protobuf:"varint,1,opt,name=index" json:"index"`
}

ErrPosition describes the position of an error in a Batch. A simple nullable primitive field would break compatibility with proto3, where primitive fields are no longer allowed to be nullable.

func (*ErrPosition) Marshal

func (m *ErrPosition) Marshal() (data []byte, err error)

func (*ErrPosition) MarshalTo

func (m *ErrPosition) MarshalTo(data []byte) (int, error)

func (*ErrPosition) ProtoMessage

func (*ErrPosition) ProtoMessage()

func (*ErrPosition) Reset

func (m *ErrPosition) Reset()

func (*ErrPosition) Size

func (m *ErrPosition) Size() (n int)

func (*ErrPosition) Unmarshal

func (m *ErrPosition) Unmarshal(data []byte) error

type Error

type Error struct {
	// message is a human-readable error message.
	Message string `protobuf:"bytes,1,opt,name=message" json:"message"`
	// If retryable is true, the error condition may be transient and the failed
	// operation may be retried (within the same transaction).
	Retryable bool `protobuf:"varint,2,opt,name=retryable" json:"retryable"`
	// If transaction_restart is not ABORT, the error condition may be handled by
	// restarting the transaction (with or without a backoff).
	TransactionRestart TransactionRestart `protobuf:"varint,3,opt,name=transaction_restart,enum=cockroach.roachpb.TransactionRestart" json:"transaction_restart"`
	// If an ErrorDetail is present, it may contain additional structured data
	// about the error.
	Detail *ErrorDetail `protobuf:"bytes,4,opt,name=detail" json:"detail,omitempty"`
}

Error is a generic representation including a string message and information about retryability.

func NewError

func NewError(err error) *Error

NewError creates an Error from the given error.

func (*Error) GoError

func (e *Error) GoError() error

GoError returns the non-nil error from the roachpb.Error union.

func (*Error) Marshal

func (m *Error) Marshal() (data []byte, err error)

func (*Error) MarshalTo

func (m *Error) MarshalTo(data []byte) (int, error)

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) SetGoError

func (e *Error) SetGoError(err error)

SetGoError sets Error using err.

func (*Error) Size

func (m *Error) Size() (n int)

func (*Error) String

func (e *Error) String() string

String implements fmt.Stringer.

func (*Error) Unmarshal

func (m *Error) Unmarshal(data []byte) error

type ErrorDetail

type ErrorDetail struct {
	NotLeader                     *NotLeaderError                     `protobuf:"bytes,1,opt,name=not_leader" json:"not_leader,omitempty"`
	RangeNotFound                 *RangeNotFoundError                 `protobuf:"bytes,2,opt,name=range_not_found" json:"range_not_found,omitempty"`
	RangeKeyMismatch              *RangeKeyMismatchError              `protobuf:"bytes,3,opt,name=range_key_mismatch" json:"range_key_mismatch,omitempty"`
	ReadWithinUncertaintyInterval *ReadWithinUncertaintyIntervalError `protobuf:"bytes,4,opt,name=read_within_uncertainty_interval" json:"read_within_uncertainty_interval,omitempty"`
	TransactionAborted            *TransactionAbortedError            `protobuf:"bytes,5,opt,name=transaction_aborted" json:"transaction_aborted,omitempty"`
	TransactionPush               *TransactionPushError               `protobuf:"bytes,6,opt,name=transaction_push" json:"transaction_push,omitempty"`
	TransactionRetry              *TransactionRetryError              `protobuf:"bytes,7,opt,name=transaction_retry" json:"transaction_retry,omitempty"`
	TransactionStatus             *TransactionStatusError             `protobuf:"bytes,8,opt,name=transaction_status" json:"transaction_status,omitempty"`
	WriteIntent                   *WriteIntentError                   `protobuf:"bytes,9,opt,name=write_intent" json:"write_intent,omitempty"`
	WriteTooOld                   *WriteTooOldError                   `protobuf:"bytes,10,opt,name=write_too_old" json:"write_too_old,omitempty"`
	OpRequiresTxn                 *OpRequiresTxnError                 `protobuf:"bytes,11,opt,name=op_requires_txn" json:"op_requires_txn,omitempty"`
	ConditionFailed               *ConditionFailedError               `protobuf:"bytes,12,opt,name=condition_failed" json:"condition_failed,omitempty"`
	LeaseRejected                 *LeaseRejectedError                 `protobuf:"bytes,13,opt,name=lease_rejected" json:"lease_rejected,omitempty"`
	NodeUnavailable               *NodeUnavailableError               `protobuf:"bytes,14,opt,name=node_unavailable" json:"node_unavailable,omitempty"`
	Send                          *SendError                          `protobuf:"bytes,15,opt,name=send" json:"send,omitempty"`
}

ErrorDetail is a union type containing all available errors.

func (*ErrorDetail) GetValue

func (this *ErrorDetail) GetValue() interface{}

func (*ErrorDetail) Marshal

func (m *ErrorDetail) Marshal() (data []byte, err error)

func (*ErrorDetail) MarshalTo

func (m *ErrorDetail) MarshalTo(data []byte) (int, error)

func (*ErrorDetail) ProtoMessage

func (*ErrorDetail) ProtoMessage()

func (*ErrorDetail) Reset

func (m *ErrorDetail) Reset()

func (*ErrorDetail) SetValue

func (this *ErrorDetail) SetValue(value interface{}) bool

func (*ErrorDetail) Size

func (m *ErrorDetail) Size() (n int)

func (*ErrorDetail) Unmarshal

func (m *ErrorDetail) Unmarshal(data []byte) error

type GCMetadata

type GCMetadata struct {
	// The last GC scan timestamp in nanoseconds since the Unix epoch.
	LastScanNanos int64 `protobuf:"varint,1,opt,name=last_scan_nanos" json:"last_scan_nanos"`
	// The oldest unresolved write intent in nanoseconds since epoch.
	// Null if there are no unresolved write intents.
	OldestIntentNanos *int64 `protobuf:"varint,2,opt,name=oldest_intent_nanos" json:"oldest_intent_nanos,omitempty"`
}

GCMetadata holds information about the last complete key/value garbage collection scan of a range.

func NewGCMetadata

func NewGCMetadata(nowNanos int64) *GCMetadata

NewGCMetadata returns a GCMetadata initialized to have a ByteCounts slice with ten byte count values set to zero. Now is specified as nanoseconds since the Unix epoch.

func (*GCMetadata) Marshal

func (m *GCMetadata) Marshal() (data []byte, err error)

func (*GCMetadata) MarshalTo

func (m *GCMetadata) MarshalTo(data []byte) (int, error)

func (*GCMetadata) ProtoMessage

func (*GCMetadata) ProtoMessage()

func (*GCMetadata) Reset

func (m *GCMetadata) Reset()

func (*GCMetadata) Size

func (m *GCMetadata) Size() (n int)

func (*GCMetadata) String

func (m *GCMetadata) String() string

func (*GCMetadata) Unmarshal

func (m *GCMetadata) Unmarshal(data []byte) error

type GCRequest

type GCRequest struct {
	Span   `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	GCMeta GCMetadata        `protobuf:"bytes,2,opt,name=gc_meta" json:"gc_meta"`
	Keys   []GCRequest_GCKey `protobuf:"bytes,3,rep,name=keys" json:"keys"`
}

A GCRequest is arguments to the GC() method. It's sent by range leaders after scanning range data to find expired MVCC values.

func (*GCRequest) CreateReply

func (*GCRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*GCRequest) Marshal

func (m *GCRequest) Marshal() (data []byte, err error)

func (*GCRequest) MarshalTo

func (m *GCRequest) MarshalTo(data []byte) (int, error)

func (*GCRequest) Method

func (*GCRequest) Method() Method

Method implements the Request interface.

func (*GCRequest) ProtoMessage

func (*GCRequest) ProtoMessage()

func (*GCRequest) Reset

func (m *GCRequest) Reset()

func (*GCRequest) Size

func (m *GCRequest) Size() (n int)

func (*GCRequest) String

func (m *GCRequest) String() string

func (*GCRequest) Unmarshal

func (m *GCRequest) Unmarshal(data []byte) error

type GCRequest_GCKey

type GCRequest_GCKey struct {
	Key       Key       `protobuf:"bytes,1,opt,name=key,casttype=Key" json:"key,omitempty"`
	Timestamp Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp"`
}

func (*GCRequest_GCKey) Marshal

func (m *GCRequest_GCKey) Marshal() (data []byte, err error)

func (*GCRequest_GCKey) MarshalTo

func (m *GCRequest_GCKey) MarshalTo(data []byte) (int, error)

func (*GCRequest_GCKey) ProtoMessage

func (*GCRequest_GCKey) ProtoMessage()

func (*GCRequest_GCKey) Reset

func (m *GCRequest_GCKey) Reset()

func (*GCRequest_GCKey) Size

func (m *GCRequest_GCKey) Size() (n int)

func (*GCRequest_GCKey) String

func (m *GCRequest_GCKey) String() string

func (*GCRequest_GCKey) Unmarshal

func (m *GCRequest_GCKey) Unmarshal(data []byte) error

type GCResponse

type GCResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A GCResponse is the return value from the GC() method.

func (*GCResponse) Marshal

func (m *GCResponse) Marshal() (data []byte, err error)

func (*GCResponse) MarshalTo

func (m *GCResponse) MarshalTo(data []byte) (int, error)

func (*GCResponse) ProtoMessage

func (*GCResponse) ProtoMessage()

func (*GCResponse) Reset

func (m *GCResponse) Reset()

func (*GCResponse) Size

func (m *GCResponse) Size() (n int)

func (*GCResponse) String

func (m *GCResponse) String() string

func (*GCResponse) Unmarshal

func (m *GCResponse) Unmarshal(data []byte) error

type GetRequest

type GetRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A GetRequest is the argument for the Get() method.

func (*GetRequest) CreateReply

func (*GetRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*GetRequest) Marshal

func (m *GetRequest) Marshal() (data []byte, err error)

func (*GetRequest) MarshalTo

func (m *GetRequest) MarshalTo(data []byte) (int, error)

func (*GetRequest) Method

func (*GetRequest) Method() Method

Method implements the Request interface.

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) Reset

func (m *GetRequest) Reset()

func (*GetRequest) Size

func (m *GetRequest) Size() (n int)

func (*GetRequest) String

func (m *GetRequest) String() string

func (*GetRequest) Unmarshal

func (m *GetRequest) Unmarshal(data []byte) error

type GetResponse

type GetResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Value          *Value `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

A GetResponse is the return value from the Get() method. If the key doesn't exist, returns nil for Value.Bytes.

func (*GetResponse) Marshal

func (m *GetResponse) Marshal() (data []byte, err error)

func (*GetResponse) MarshalTo

func (m *GetResponse) MarshalTo(data []byte) (int, error)

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) Reset

func (m *GetResponse) Reset()

func (*GetResponse) Size

func (m *GetResponse) Size() (n int)

func (*GetResponse) String

func (m *GetResponse) String() string

func (*GetResponse) Unmarshal

func (m *GetResponse) Unmarshal(data []byte) error

func (*GetResponse) Verify

func (gr *GetResponse) Verify(req Request) error

Verify verifies the integrity of the get response value.

type Header struct {
	// timestamp specifies time at which read or writes should be
	// performed. If the timestamp is set to zero value, its value
	// is initialized to the wall time of the receiving node.
	Timestamp Timestamp `protobuf:"bytes,1,opt,name=timestamp" json:"timestamp"`
	// cmd_id is optionally specified for request idempotence
	// (i.e. replay protection).
	Replica ReplicaDescriptor `protobuf:"bytes,2,opt,name=replica" json:"replica"`
	// range_id specifies the ID of the Raft consensus group which the key
	// range belongs to. This is used by the receiving node to route the
	// request to the correct range.
	RangeID RangeID `protobuf:"varint,3,opt,name=range_id,casttype=RangeID" json:"range_id"`
	// user_priority specifies priority multiple for non-transactional
	// commands. This value should be a positive integer [1, 2^31-1).
	// It's properly viewed as a multiple for how likely this
	// transaction will be to prevail if a write conflict occurs.
	// Commands with user_priority=100 will be 100x less likely to be
	// aborted as conflicting transactions or non-transactional commands
	// with user_priority=1. This value is ignored if Txn is
	// specified. If neither this value nor txn is specified, the value
	// defaults to 1.
	UserPriority *int32 `protobuf:"varint,4,opt,name=user_priority,def=1" json:"user_priority,omitempty"`
	// txn is set non-nil if a transaction is underway. To start a txn,
	// the first request should set this field to non-nil with name and
	// isolation level set as desired. The response will contain the
	// fully-initialized transaction with txn ID, priority, initial
	// timestamp, and maximum timestamp.
	Txn *Transaction `protobuf:"bytes,5,opt,name=txn" json:"txn,omitempty"`
	// read_consistency specifies the consistency for read
	// operations. The default is CONSISTENT. This value is ignored for
	// write operations.
	ReadConsistency ReadConsistencyType `protobuf:"varint,6,opt,name=read_consistency,enum=cockroach.roachpb.ReadConsistencyType" json:"read_consistency"`
}

A Header is attached to a BatchRequest, encapsulating routing and auxiliary information required for executing it.

func (*Header) GetRangeID

func (m *Header) GetRangeID() RangeID

func (*Header) GetReadConsistency

func (m *Header) GetReadConsistency() ReadConsistencyType

func (*Header) GetReplica

func (m *Header) GetReplica() ReplicaDescriptor

func (*Header) GetTimestamp

func (m *Header) GetTimestamp() Timestamp

func (*Header) GetTxn

func (m *Header) GetTxn() *Transaction

func (*Header) GetUserPriority

func (m *Header) GetUserPriority() int32

func (*Header) Marshal

func (m *Header) Marshal() (data []byte, err error)

func (*Header) MarshalTo

func (m *Header) MarshalTo(data []byte) (int, error)

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) Reset

func (m *Header) Reset()

func (*Header) Size

func (m *Header) Size() (n int)

func (*Header) String

func (m *Header) String() string

func (*Header) Unmarshal

func (m *Header) Unmarshal(data []byte) error

type HeartbeatTxnRequest

type HeartbeatTxnRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A HeartbeatTxnRequest is arguments to the HeartbeatTxn() method. It's sent by transaction coordinators to let the system know that the transaction is still ongoing. Note that this heartbeat message is different from the heartbeat message in the gossip protocol.

func (*HeartbeatTxnRequest) CreateReply

func (*HeartbeatTxnRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*HeartbeatTxnRequest) Marshal

func (m *HeartbeatTxnRequest) Marshal() (data []byte, err error)

func (*HeartbeatTxnRequest) MarshalTo

func (m *HeartbeatTxnRequest) MarshalTo(data []byte) (int, error)

func (*HeartbeatTxnRequest) Method

func (*HeartbeatTxnRequest) Method() Method

Method implements the Request interface.

func (*HeartbeatTxnRequest) ProtoMessage

func (*HeartbeatTxnRequest) ProtoMessage()

func (*HeartbeatTxnRequest) Reset

func (m *HeartbeatTxnRequest) Reset()

func (*HeartbeatTxnRequest) Size

func (m *HeartbeatTxnRequest) Size() (n int)

func (*HeartbeatTxnRequest) String

func (m *HeartbeatTxnRequest) String() string

func (*HeartbeatTxnRequest) Unmarshal

func (m *HeartbeatTxnRequest) Unmarshal(data []byte) error

type HeartbeatTxnResponse

type HeartbeatTxnResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A HeartbeatTxnResponse is the return value from the HeartbeatTxn() method. It returns the transaction info in the response header. The returned transaction lets the coordinator know the disposition of the transaction (i.e. aborted, committed, or pending).

func (*HeartbeatTxnResponse) Marshal

func (m *HeartbeatTxnResponse) Marshal() (data []byte, err error)

func (*HeartbeatTxnResponse) MarshalTo

func (m *HeartbeatTxnResponse) MarshalTo(data []byte) (int, error)

func (*HeartbeatTxnResponse) ProtoMessage

func (*HeartbeatTxnResponse) ProtoMessage()

func (*HeartbeatTxnResponse) Reset

func (m *HeartbeatTxnResponse) Reset()

func (*HeartbeatTxnResponse) Size

func (m *HeartbeatTxnResponse) Size() (n int)

func (*HeartbeatTxnResponse) String

func (m *HeartbeatTxnResponse) String() string

func (*HeartbeatTxnResponse) Unmarshal

func (m *HeartbeatTxnResponse) Unmarshal(data []byte) error

type IncrementRequest

type IncrementRequest struct {
	Span      `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Increment int64 `protobuf:"varint,2,opt,name=increment" json:"increment"`
}

An IncrementRequest is the argument to the Increment() method. It increments the value for key, and returns the new value. If no value exists for a key, incrementing by 0 is not a noop, but will create a zero value. IncrementRequest cannot be called on a key set by Put() or ConditionalPut(). Similarly, Put() and ConditionalPut() cannot be invoked on an incremented key.

func (*IncrementRequest) CreateReply

func (*IncrementRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*IncrementRequest) Marshal

func (m *IncrementRequest) Marshal() (data []byte, err error)

func (*IncrementRequest) MarshalTo

func (m *IncrementRequest) MarshalTo(data []byte) (int, error)

func (*IncrementRequest) Method

func (*IncrementRequest) Method() Method

Method implements the Request interface.

func (*IncrementRequest) ProtoMessage

func (*IncrementRequest) ProtoMessage()

func (*IncrementRequest) Reset

func (m *IncrementRequest) Reset()

func (*IncrementRequest) Size

func (m *IncrementRequest) Size() (n int)

func (*IncrementRequest) String

func (m *IncrementRequest) String() string

func (*IncrementRequest) Unmarshal

func (m *IncrementRequest) Unmarshal(data []byte) error

type IncrementResponse

type IncrementResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	NewValue       int64 `protobuf:"varint,2,opt,name=new_value" json:"new_value"`
}

An IncrementResponse is the return value from the Increment method. The new value after increment is specified in NewValue. If the value could not be decoded as specified, Error will be set.

func (*IncrementResponse) Marshal

func (m *IncrementResponse) Marshal() (data []byte, err error)

func (*IncrementResponse) MarshalTo

func (m *IncrementResponse) MarshalTo(data []byte) (int, error)

func (*IncrementResponse) ProtoMessage

func (*IncrementResponse) ProtoMessage()

func (*IncrementResponse) Reset

func (m *IncrementResponse) Reset()

func (*IncrementResponse) Size

func (m *IncrementResponse) Size() (n int)

func (*IncrementResponse) String

func (m *IncrementResponse) String() string

func (*IncrementResponse) Unmarshal

func (m *IncrementResponse) Unmarshal(data []byte) error

type IndexedError

type IndexedError interface {
	ErrorIndex() (int32, bool) // bool is false iff no index associated
	SetErrorIndex(int32)
}

IndexedError is an interface implemented by errors which can be associated with a failed request in a Batch.

type Int32Slice

type Int32Slice []int32

Int32Slice implements sort.Interface.

func (Int32Slice) Len

func (s Int32Slice) Len() int

func (Int32Slice) Less

func (s Int32Slice) Less(i, j int) bool

func (Int32Slice) Swap

func (s Int32Slice) Swap(i, j int)

type Intent

type Intent struct {
	Span `protobuf:"bytes,1,opt,name=span,embedded=span" json:"span"`
	Txn  Transaction `protobuf:"bytes,2,opt,name=txn" json:"txn"`
}

A Intent is a Span together with a Transaction.

func (*Intent) Marshal

func (m *Intent) Marshal() (data []byte, err error)

func (*Intent) MarshalTo

func (m *Intent) MarshalTo(data []byte) (int, error)

func (*Intent) ProtoMessage

func (*Intent) ProtoMessage()

func (*Intent) Reset

func (m *Intent) Reset()

func (*Intent) Size

func (m *Intent) Size() (n int)

func (*Intent) String

func (m *Intent) String() string

func (*Intent) Unmarshal

func (m *Intent) Unmarshal(data []byte) error

type InternalCommitTrigger

type InternalCommitTrigger struct {
	SplitTrigger          *SplitTrigger          `protobuf:"bytes,1,opt,name=split_trigger" json:"split_trigger,omitempty"`
	MergeTrigger          *MergeTrigger          `protobuf:"bytes,2,opt,name=merge_trigger" json:"merge_trigger,omitempty"`
	ChangeReplicasTrigger *ChangeReplicasTrigger `protobuf:"bytes,3,opt,name=change_replicas_trigger" json:"change_replicas_trigger,omitempty"`
	ModifiedSpanTrigger   *ModifiedSpanTrigger   `protobuf:"bytes,4,opt,name=modified_span_trigger" json:"modified_span_trigger,omitempty"`
}

InternalCommitTrigger encapsulates all of the internal-only commit triggers. Only one may be set.

func (*InternalCommitTrigger) GetChangeReplicasTrigger

func (m *InternalCommitTrigger) GetChangeReplicasTrigger() *ChangeReplicasTrigger

func (*InternalCommitTrigger) GetMergeTrigger

func (m *InternalCommitTrigger) GetMergeTrigger() *MergeTrigger

func (*InternalCommitTrigger) GetModifiedSpanTrigger

func (m *InternalCommitTrigger) GetModifiedSpanTrigger() *ModifiedSpanTrigger

func (*InternalCommitTrigger) GetSplitTrigger

func (m *InternalCommitTrigger) GetSplitTrigger() *SplitTrigger

func (*InternalCommitTrigger) Marshal

func (m *InternalCommitTrigger) Marshal() (data []byte, err error)

func (*InternalCommitTrigger) MarshalTo

func (m *InternalCommitTrigger) MarshalTo(data []byte) (int, error)

func (*InternalCommitTrigger) ProtoMessage

func (*InternalCommitTrigger) ProtoMessage()

func (*InternalCommitTrigger) Reset

func (m *InternalCommitTrigger) Reset()

func (*InternalCommitTrigger) Size

func (m *InternalCommitTrigger) Size() (n int)

func (*InternalCommitTrigger) String

func (m *InternalCommitTrigger) String() string

func (*InternalCommitTrigger) Unmarshal

func (m *InternalCommitTrigger) Unmarshal(data []byte) error

type InternalTimeSeriesData

type InternalTimeSeriesData struct {
	// Holds a wall time, expressed as a unix epoch time in nanoseconds. This
	// represents the earliest possible timestamp for a sample within the
	// collection.
	StartTimestampNanos int64 `protobuf:"varint,1,opt,name=start_timestamp_nanos" json:"start_timestamp_nanos"`
	// The duration of each sample interval, expressed in nanoseconds.
	SampleDurationNanos int64 `protobuf:"varint,2,opt,name=sample_duration_nanos" json:"sample_duration_nanos"`
	// The actual data samples for this metric.
	Samples []*InternalTimeSeriesSample `protobuf:"bytes,3,rep,name=samples" json:"samples,omitempty"`
}

InternalTimeSeriesData is a collection of data samples for some measurable value, where each sample is taken over a uniform time interval.

The collection itself contains a start timestamp (in seconds since the unix epoch) and a sample duration (in milliseconds). Each sample in the collection will contain a positive integer offset that indicates the length of time between the start_timestamp of the collection and the time when the sample began, expressed as an whole number of sample intervals. For example, if the sample duration is 60000 (indicating 1 minute), then a contained sample with an offset value of 5 begins (5*60000ms = 300000ms = 5 minutes) after the start timestamp of this data.

This is meant to be an efficient internal representation of time series data, ensuring that very little redundant data is stored on disk. With this goal in mind, this message does not identify the variable which is actually being measured; that information is expected be encoded in the key where this message is stored.

func (*InternalTimeSeriesData) Marshal

func (m *InternalTimeSeriesData) Marshal() (data []byte, err error)

func (*InternalTimeSeriesData) MarshalTo

func (m *InternalTimeSeriesData) MarshalTo(data []byte) (int, error)

func (*InternalTimeSeriesData) ProtoMessage

func (*InternalTimeSeriesData) ProtoMessage()

func (*InternalTimeSeriesData) Reset

func (m *InternalTimeSeriesData) Reset()

func (*InternalTimeSeriesData) Size

func (m *InternalTimeSeriesData) Size() (n int)

func (*InternalTimeSeriesData) String

func (m *InternalTimeSeriesData) String() string

func (*InternalTimeSeriesData) Unmarshal

func (m *InternalTimeSeriesData) Unmarshal(data []byte) error

type InternalTimeSeriesSample

type InternalTimeSeriesSample struct {
	// Temporal offset from the "start_timestamp" of the InternalTimeSeriesData
	// collection this data point is part in. The units of this value are
	// determined by the value of the "sample_duration_milliseconds" field of
	// the TimeSeriesData collection.
	Offset int32 `protobuf:"varint,1,opt,name=offset" json:"offset"`
	// Count of measurements taken within this sample.
	Count uint32 `protobuf:"varint,6,opt,name=count" json:"count"`
	// Sum of all measurements.
	Sum float64 `protobuf:"fixed64,7,opt,name=sum" json:"sum"`
	// Maximum encountered measurement in this sample.
	Max *float64 `protobuf:"fixed64,8,opt,name=max" json:"max,omitempty"`
	// Minimum encountered measurement in this sample.
	Min *float64 `protobuf:"fixed64,9,opt,name=min" json:"min,omitempty"`
}

A InternalTimeSeriesSample represents data gathered from multiple measurements of a variable value over a given period of time. The length of that period of time is stored in an InternalTimeSeriesData message; a sample cannot be interpreted correctly without a start timestamp and sample duration.

Each sample may contain data gathered from multiple measurements of the same variable, as long as all of those measurements occurred within the sample period. The sample stores several aggregated values from these measurements: - The sum of all measured values - A count of all measurements taken - The maximum individual measurement seen - The minimum individual measurement seen

If zero measurements are present in a sample, then it should be omitted entirely from any collection it would be a part of.

If the count of measurements is 1, then max and min fields may be omitted and assumed equal to the sum field.

func (*InternalTimeSeriesSample) Average

func (samp *InternalTimeSeriesSample) Average() float64

Average returns the average value for this sample.

func (*InternalTimeSeriesSample) Marshal

func (m *InternalTimeSeriesSample) Marshal() (data []byte, err error)

func (*InternalTimeSeriesSample) MarshalTo

func (m *InternalTimeSeriesSample) MarshalTo(data []byte) (int, error)

func (*InternalTimeSeriesSample) Maximum

func (samp *InternalTimeSeriesSample) Maximum() float64

Maximum returns the maximum value encountered by this sample.

func (*InternalTimeSeriesSample) Minimum

func (samp *InternalTimeSeriesSample) Minimum() float64

Minimum returns the minimum value encountered by this sample.

func (*InternalTimeSeriesSample) ProtoMessage

func (*InternalTimeSeriesSample) ProtoMessage()

func (*InternalTimeSeriesSample) Reset

func (m *InternalTimeSeriesSample) Reset()

func (*InternalTimeSeriesSample) Size

func (m *InternalTimeSeriesSample) Size() (n int)

func (*InternalTimeSeriesSample) String

func (m *InternalTimeSeriesSample) String() string

func (*InternalTimeSeriesSample) Unmarshal

func (m *InternalTimeSeriesSample) Unmarshal(data []byte) error

type IsolationType

type IsolationType int32

IsolationType TODO(jiajia) Needs documentation.

const (
	// SERIALIZABLE TODO(jiajia) Needs documentation.
	SERIALIZABLE IsolationType = 0
	// SNAPSHOT TODO(jiajia) Needs documentation.
	SNAPSHOT IsolationType = 1
)

func (IsolationType) Enum

func (x IsolationType) Enum() *IsolationType

func (IsolationType) String

func (x IsolationType) String() string

func (*IsolationType) UnmarshalJSON

func (x *IsolationType) UnmarshalJSON(data []byte) error

type Key

type Key []byte

Key is a custom type for a byte string in proto messages which refer to Cockroach keys.

func (Key) Compare

func (k Key) Compare(b interval.Comparable) int

Compare implements the interval.Comparable interface for tree nodes.

func (Key) Equal

func (k Key) Equal(l Key) bool

Equal returns whether two keys are identical.

func (Key) Format

func (k Key) Format(f fmt.State, verb rune)

Format implements the fmt.Formatter interface.

func (Key) IsPrev

func (k Key) IsPrev(m Key) bool

IsPrev is a more efficient version of k.Next().Equal(m).

func (Key) Next

func (k Key) Next() Key

Next returns the next key in lexicographic sort order.

func (Key) PrefixEnd

func (k Key) PrefixEnd() Key

PrefixEnd determines the end key given key as a prefix, that is the key that sorts precisely behind all keys starting with prefix: "1" is added to the final byte and the carry propagated. The special cases of nil and KeyMin always returns KeyMax.

func (Key) String

func (k Key) String() string

String returns a string-formatted version of the key.

type KeyValue

type KeyValue struct {
	Key   Key   `protobuf:"bytes,1,opt,name=key,casttype=Key" json:"key,omitempty"`
	Value Value `protobuf:"bytes,2,opt,name=value" json:"value"`
}

KeyValue is a pair of Key and Value for returned Key/Value pairs from ScanRequest/ScanResponse. It embeds a Key and a Value.

func (*KeyValue) Marshal

func (m *KeyValue) Marshal() (data []byte, err error)

func (*KeyValue) MarshalTo

func (m *KeyValue) MarshalTo(data []byte) (int, error)

func (*KeyValue) ProtoMessage

func (*KeyValue) ProtoMessage()

func (*KeyValue) Reset

func (m *KeyValue) Reset()

func (*KeyValue) Size

func (m *KeyValue) Size() (n int)

func (*KeyValue) String

func (m *KeyValue) String() string

func (*KeyValue) Unmarshal

func (m *KeyValue) Unmarshal(data []byte) error

type LeaderLeaseRequest

type LeaderLeaseRequest struct {
	Span  `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Lease Lease `protobuf:"bytes,2,opt,name=lease" json:"lease"`
}

A LeaderLeaseRequest is arguments to the LeaderLease() method. It is sent by the store on behalf of one of its ranges upon receipt of a leader election event for that range.

func (*LeaderLeaseRequest) CreateReply

func (*LeaderLeaseRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*LeaderLeaseRequest) Marshal

func (m *LeaderLeaseRequest) Marshal() (data []byte, err error)

func (*LeaderLeaseRequest) MarshalTo

func (m *LeaderLeaseRequest) MarshalTo(data []byte) (int, error)

func (*LeaderLeaseRequest) Method

func (*LeaderLeaseRequest) Method() Method

Method implements the Request interface.

func (*LeaderLeaseRequest) ProtoMessage

func (*LeaderLeaseRequest) ProtoMessage()

func (*LeaderLeaseRequest) Reset

func (m *LeaderLeaseRequest) Reset()

func (*LeaderLeaseRequest) Size

func (m *LeaderLeaseRequest) Size() (n int)

func (*LeaderLeaseRequest) String

func (m *LeaderLeaseRequest) String() string

func (*LeaderLeaseRequest) Unmarshal

func (m *LeaderLeaseRequest) Unmarshal(data []byte) error

type LeaderLeaseResponse

type LeaderLeaseResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A LeaderLeaseResponse is the response to a LeaderLease() operation.

func (*LeaderLeaseResponse) Marshal

func (m *LeaderLeaseResponse) Marshal() (data []byte, err error)

func (*LeaderLeaseResponse) MarshalTo

func (m *LeaderLeaseResponse) MarshalTo(data []byte) (int, error)

func (*LeaderLeaseResponse) ProtoMessage

func (*LeaderLeaseResponse) ProtoMessage()

func (*LeaderLeaseResponse) Reset

func (m *LeaderLeaseResponse) Reset()

func (*LeaderLeaseResponse) Size

func (m *LeaderLeaseResponse) Size() (n int)

func (*LeaderLeaseResponse) String

func (m *LeaderLeaseResponse) String() string

func (*LeaderLeaseResponse) Unmarshal

func (m *LeaderLeaseResponse) Unmarshal(data []byte) error

type Lease

type Lease struct {
	// The start is a timestamp at which the lease begins. This value
	// must be greater than the last lease expiration or this call will
	// fail.
	Start Timestamp `protobuf:"bytes,1,opt,name=start" json:"start"`
	// The expiration is a timestamp at which the lease will expire.
	Expiration Timestamp `protobuf:"bytes,2,opt,name=expiration" json:"expiration"`
	// The address of the would-be lease holder.
	Replica ReplicaDescriptor `protobuf:"bytes,3,opt,name=replica" json:"replica"`
}

Lease contains information about leader leases including the expiration and lease holder.

func (Lease) Covers

func (l Lease) Covers(timestamp Timestamp) bool

Covers returns true if the given timestamp is strictly less than the Lease expiration, which indicates that the lease holder is authorized to carry out operations with that timestamp.

func (*Lease) Marshal

func (m *Lease) Marshal() (data []byte, err error)

func (*Lease) MarshalTo

func (m *Lease) MarshalTo(data []byte) (int, error)

func (Lease) OwnedBy

func (l Lease) OwnedBy(storeID StoreID) bool

OwnedBy returns whether the given store is the lease owner.

func (*Lease) ProtoMessage

func (*Lease) ProtoMessage()

func (*Lease) Reset

func (m *Lease) Reset()

func (*Lease) Size

func (m *Lease) Size() (n int)

func (Lease) String

func (l Lease) String() string

func (*Lease) Unmarshal

func (m *Lease) Unmarshal(data []byte) error

type LeaseRejectedError

type LeaseRejectedError struct {
	Message   string `protobuf:"bytes,1,opt,name=message" json:"message"`
	Requested Lease  `protobuf:"bytes,2,opt,name=requested" json:"requested"`
	Existing  Lease  `protobuf:"bytes,3,opt,name=existing" json:"existing"`
}

A LeaseRejectedError indicates that the requested replica could not acquire the desired lease because of an existing leader lease.

func (*LeaseRejectedError) CanRetry

func (e *LeaseRejectedError) CanRetry() bool

CanRetry indicates that this error can not be retried; it should never make it back to the client anyways.

func (*LeaseRejectedError) Error

func (e *LeaseRejectedError) Error() string

Error formats error.

func (*LeaseRejectedError) Marshal

func (m *LeaseRejectedError) Marshal() (data []byte, err error)

func (*LeaseRejectedError) MarshalTo

func (m *LeaseRejectedError) MarshalTo(data []byte) (int, error)

func (*LeaseRejectedError) ProtoMessage

func (*LeaseRejectedError) ProtoMessage()

func (*LeaseRejectedError) Reset

func (m *LeaseRejectedError) Reset()

func (*LeaseRejectedError) Size

func (m *LeaseRejectedError) Size() (n int)

func (*LeaseRejectedError) Unmarshal

func (m *LeaseRejectedError) Unmarshal(data []byte) error

type MergeRequest

type MergeRequest struct {
	Span  `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Value Value `protobuf:"bytes,2,opt,name=value" json:"value"`
}

A MergeRequest contains arguments to the Merge() method. It specifies a key and a value which should be merged into the existing value at that key.

func (*MergeRequest) CreateReply

func (*MergeRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*MergeRequest) Marshal

func (m *MergeRequest) Marshal() (data []byte, err error)

func (*MergeRequest) MarshalTo

func (m *MergeRequest) MarshalTo(data []byte) (int, error)

func (*MergeRequest) Method

func (*MergeRequest) Method() Method

Method implements the Request interface.

func (*MergeRequest) ProtoMessage

func (*MergeRequest) ProtoMessage()

func (*MergeRequest) Reset

func (m *MergeRequest) Reset()

func (*MergeRequest) Size

func (m *MergeRequest) Size() (n int)

func (*MergeRequest) String

func (m *MergeRequest) String() string

func (*MergeRequest) Unmarshal

func (m *MergeRequest) Unmarshal(data []byte) error

type MergeResponse

type MergeResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

MergeResponse is the response to a Merge() operation.

func (*MergeResponse) Marshal

func (m *MergeResponse) Marshal() (data []byte, err error)

func (*MergeResponse) MarshalTo

func (m *MergeResponse) MarshalTo(data []byte) (int, error)

func (*MergeResponse) ProtoMessage

func (*MergeResponse) ProtoMessage()

func (*MergeResponse) Reset

func (m *MergeResponse) Reset()

func (*MergeResponse) Size

func (m *MergeResponse) Size() (n int)

func (*MergeResponse) String

func (m *MergeResponse) String() string

func (*MergeResponse) Unmarshal

func (m *MergeResponse) Unmarshal(data []byte) error

type MergeTrigger

type MergeTrigger struct {
	UpdatedDesc     RangeDescriptor `protobuf:"bytes,1,opt,name=updated_desc" json:"updated_desc"`
	SubsumedRangeID RangeID         `protobuf:"varint,2,opt,name=subsumed_range_id,casttype=RangeID" json:"subsumed_range_id"`
}

A MergeTrigger is run after a successful commit of an AdminMerge command. It provides the updated range descriptor that now encompasses what was originally both ranges. This information allows the final bookkeeping for the merge to be completed and put into operation.

func (*MergeTrigger) Marshal

func (m *MergeTrigger) Marshal() (data []byte, err error)

func (*MergeTrigger) MarshalTo

func (m *MergeTrigger) MarshalTo(data []byte) (int, error)

func (*MergeTrigger) ProtoMessage

func (*MergeTrigger) ProtoMessage()

func (*MergeTrigger) Reset

func (m *MergeTrigger) Reset()

func (*MergeTrigger) Size

func (m *MergeTrigger) Size() (n int)

func (*MergeTrigger) String

func (m *MergeTrigger) String() string

func (*MergeTrigger) Unmarshal

func (m *MergeTrigger) Unmarshal(data []byte) error

type Method

type Method int

Method is the enumerated type for methods.

const (
	// Get fetches the value for a key from the KV map, respecting a
	// possibly historical timestamp. If the timestamp is 0, returns
	// the most recent value.
	Get Method = iota
	// Put sets the value for a key at the specified timestamp. If the
	// timestamp is 0, the value is set with the current time as timestamp.
	Put
	// ConditionalPut sets the value for a key if the existing value
	// matches the value specified in the request. Specifying a null value
	// for existing means the value must not yet exist.
	ConditionalPut
	// Increment increments the value at the specified key. Once called
	// for a key, Put & ConditionalPut will return errors; only
	// Increment will continue to be a valid command. The value must be
	// deleted before it can be reset using Put.
	Increment
	// Delete removes the value for the specified key.
	Delete
	// DeleteRange removes all values for keys which fall between
	// args.RequestHeader.Key and args.RequestHeader.EndKey, with
	// the latter endpoint excluded.
	DeleteRange
	// Scan fetches the values for all keys which fall between
	// args.RequestHeader.Key and args.RequestHeader.EndKey, with
	// the latter endpoint excluded.
	Scan
	// ReverseScan fetches the values for all keys which fall between
	// args.RequestHeader.Key and args.RequestHeader.EndKey, with
	// the latter endpoint excluded.
	ReverseScan
	// BeginTransaction writes a new transaction record, marking the
	// beginning of the write-portion of a transaction. It is sent
	// exclusively by the coordinating node along with the first
	// transactional write and neither sent nor received by the client
	// itself.
	BeginTransaction
	// EndTransaction either commits or aborts an ongoing transaction.
	EndTransaction
	// AdminSplit is called to coordinate a split of a range.
	AdminSplit
	// AdminMerge is called to coordinate a merge of two adjacent ranges.
	AdminMerge
	// HeartbeatTxn sends a periodic heartbeat to extant
	// transaction rows to indicate the client is still alive and
	// the transaction should not be considered abandoned.
	HeartbeatTxn
	// GC garbage collects values based on expired timestamps
	// for a list of keys in a range. This method is called by the
	// range leader after a snapshot scan. The call goes through Raft,
	// so all range replicas GC the exact same values.
	GC
	// PushTxn attempts to resolve read or write conflicts between
	// transactions. Both the pusher (args.Txn) and the pushee
	// (args.PushTxn) are supplied. However, args.Key should be set to the
	// transaction ID of the pushee, as it must be directed to the range
	// containing the pushee's transaction record in order to consult the
	// most up to date txn state. If the conflict resolution can be
	// resolved in favor of the pusher, returns success; otherwise returns
	// an error code either indicating the pusher must retry or abort and
	// restart the transaction.
	PushTxn
	// RangeLookup looks up range descriptors, containing the
	// locations of replicas for the range containing the specified key.
	RangeLookup
	// ResolveIntent resolves existing write intents for a key.
	ResolveIntent
	// ResolveIntentRange resolves existing write intents for a key range.
	ResolveIntentRange
	// Noop is a no-op.
	Noop
	// Merge merges a given value into the specified key. Merge is a
	// high-performance operation provided by underlying data storage for values
	// which are accumulated over several writes. Because it is not
	// transactional, Merge is currently not made available to external clients.
	//
	// The logic used to merge values of different types is described in more
	// detail by the "Merge" method of engine.Engine.
	Merge
	// TruncateLog discards a prefix of the raft log.
	TruncateLog
	// LeaderLease requests a leader lease for a replica.
	LeaderLease
	// Batch implements batch processing of commands. This is a
	// superset of the Batch method.
	Batch
)

func (Method) String

func (i Method) String() string

type ModifiedSpanTrigger

type ModifiedSpanTrigger struct {
	SystemDBSpan bool `protobuf:"varint,1,opt,name=system_db_span" json:"system_db_span"`
}

ModifiedSpanTrigger indicates that a specific span has been modified. This can be used to trigger scan-and-gossip for the given span.

func (*ModifiedSpanTrigger) Marshal

func (m *ModifiedSpanTrigger) Marshal() (data []byte, err error)

func (*ModifiedSpanTrigger) MarshalTo

func (m *ModifiedSpanTrigger) MarshalTo(data []byte) (int, error)

func (*ModifiedSpanTrigger) ProtoMessage

func (*ModifiedSpanTrigger) ProtoMessage()

func (*ModifiedSpanTrigger) Reset

func (m *ModifiedSpanTrigger) Reset()

func (*ModifiedSpanTrigger) Size

func (m *ModifiedSpanTrigger) Size() (n int)

func (*ModifiedSpanTrigger) String

func (m *ModifiedSpanTrigger) String() string

func (*ModifiedSpanTrigger) Unmarshal

func (m *ModifiedSpanTrigger) Unmarshal(data []byte) error

type NodeDescriptor

type NodeDescriptor struct {
	NodeID  NodeID                        `protobuf:"varint,1,opt,name=node_id,casttype=NodeID" json:"node_id"`
	Address cockroach_util.UnresolvedAddr `protobuf:"bytes,2,opt,name=address" json:"address"`
	Attrs   Attributes                    `protobuf:"bytes,3,opt,name=attrs" json:"attrs"`
}

NodeDescriptor holds details on node physical/network topology.

func (*NodeDescriptor) Marshal

func (m *NodeDescriptor) Marshal() (data []byte, err error)

func (*NodeDescriptor) MarshalTo

func (m *NodeDescriptor) MarshalTo(data []byte) (int, error)

func (*NodeDescriptor) ProtoMessage

func (*NodeDescriptor) ProtoMessage()

func (*NodeDescriptor) Reset

func (m *NodeDescriptor) Reset()

func (*NodeDescriptor) Size

func (m *NodeDescriptor) Size() (n int)

func (*NodeDescriptor) String

func (m *NodeDescriptor) String() string

func (*NodeDescriptor) Unmarshal

func (m *NodeDescriptor) Unmarshal(data []byte) error

type NodeID

type NodeID int32

NodeID is a custom type for a cockroach node ID. (not a raft node ID)

func (NodeID) String

func (n NodeID) String() string

String implements the fmt.Stringer interface. It is used to format the ID for use in Gossip keys.

type NodeIDSlice

type NodeIDSlice []NodeID

NodeIDSlice implements sort.Interface.

func (NodeIDSlice) Len

func (n NodeIDSlice) Len() int

func (NodeIDSlice) Less

func (n NodeIDSlice) Less(i, j int) bool

func (NodeIDSlice) Swap

func (n NodeIDSlice) Swap(i, j int)

type NodeList

type NodeList struct {
	// Note that this does not use the NodeID custom type because that appears
	// to interact badly with the repeated and/or packed options.
	Nodes []int32 `protobuf:"varint,1,rep,packed,name=nodes" json:"nodes,omitempty"`
}

NodeList keeps a growing set of NodeIDs as a sorted slice, with Add() adding to the set and Contains() verifying membership.

func (*NodeList) Add

func (s *NodeList) Add(nodeID NodeID)

Add adds the given NodeID to the interface (unless already present) and restores ordering.

func (NodeList) Contains

func (s NodeList) Contains(nodeID NodeID) bool

Contains returns true if the underlying slice contains the given NodeID.

func (*NodeList) Marshal

func (m *NodeList) Marshal() (data []byte, err error)

func (*NodeList) MarshalTo

func (m *NodeList) MarshalTo(data []byte) (int, error)

func (*NodeList) ProtoMessage

func (*NodeList) ProtoMessage()

func (*NodeList) Reset

func (m *NodeList) Reset()

func (*NodeList) Size

func (m *NodeList) Size() (n int)

func (*NodeList) String

func (m *NodeList) String() string

func (*NodeList) Unmarshal

func (m *NodeList) Unmarshal(data []byte) error

type NodeUnavailableError

type NodeUnavailableError struct {
}

A NodeUnavailableError indicates that the sending gateway can not process requests at the time, and that the client should retry the request with another peer.

func (*NodeUnavailableError) Error

func (e *NodeUnavailableError) Error() string

Error formats error.

func (*NodeUnavailableError) Marshal

func (m *NodeUnavailableError) Marshal() (data []byte, err error)

func (*NodeUnavailableError) MarshalTo

func (m *NodeUnavailableError) MarshalTo(data []byte) (int, error)

func (*NodeUnavailableError) ProtoMessage

func (*NodeUnavailableError) ProtoMessage()

func (*NodeUnavailableError) Reset

func (m *NodeUnavailableError) Reset()

func (*NodeUnavailableError) Size

func (m *NodeUnavailableError) Size() (n int)

func (*NodeUnavailableError) Unmarshal

func (m *NodeUnavailableError) Unmarshal(data []byte) error

type NoopRequest

type NoopRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A NoopRequest is a no-op.

func (*NoopRequest) CreateReply

func (*NoopRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*NoopRequest) Marshal

func (m *NoopRequest) Marshal() (data []byte, err error)

func (*NoopRequest) MarshalTo

func (m *NoopRequest) MarshalTo(data []byte) (int, error)

func (*NoopRequest) Method

func (*NoopRequest) Method() Method

Method implements the Request interface.

func (*NoopRequest) ProtoMessage

func (*NoopRequest) ProtoMessage()

func (*NoopRequest) Reset

func (m *NoopRequest) Reset()

func (*NoopRequest) Size

func (m *NoopRequest) Size() (n int)

func (*NoopRequest) String

func (m *NoopRequest) String() string

func (*NoopRequest) Unmarshal

func (m *NoopRequest) Unmarshal(data []byte) error

type NoopResponse

type NoopResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A NoopResponse is the return value from a no-op operation.

func (*NoopResponse) Marshal

func (m *NoopResponse) Marshal() (data []byte, err error)

func (*NoopResponse) MarshalTo

func (m *NoopResponse) MarshalTo(data []byte) (int, error)

func (*NoopResponse) ProtoMessage

func (*NoopResponse) ProtoMessage()

func (*NoopResponse) Reset

func (m *NoopResponse) Reset()

func (*NoopResponse) Size

func (m *NoopResponse) Size() (n int)

func (*NoopResponse) String

func (m *NoopResponse) String() string

func (*NoopResponse) Unmarshal

func (m *NoopResponse) Unmarshal(data []byte) error

type NotLeaderError

type NotLeaderError struct {
	Replica *ReplicaDescriptor `protobuf:"bytes,1,opt,name=replica" json:"replica,omitempty"`
	Leader  *ReplicaDescriptor `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"`
	RangeID RangeID            `protobuf:"varint,3,opt,name=range_id,casttype=RangeID" json:"range_id"`
}

A NotLeaderError indicates that the current range is not the leader. If the leader is known, its Replica is set in the error.

func (*NotLeaderError) Error

func (e *NotLeaderError) Error() string

Error formats error.

func (*NotLeaderError) Marshal

func (m *NotLeaderError) Marshal() (data []byte, err error)

func (*NotLeaderError) MarshalTo

func (m *NotLeaderError) MarshalTo(data []byte) (int, error)

func (*NotLeaderError) ProtoMessage

func (*NotLeaderError) ProtoMessage()

func (*NotLeaderError) Reset

func (m *NotLeaderError) Reset()

func (*NotLeaderError) Size

func (m *NotLeaderError) Size() (n int)

func (*NotLeaderError) Unmarshal

func (m *NotLeaderError) Unmarshal(data []byte) error

type OpRequiresTxnError

type OpRequiresTxnError struct {
}

An OpRequiresTxnError indicates that a command required to be carried out in a transactional context but was not. For example, a Scan which spans ranges requires a transaction. The operation should be retried inside of a transaction.

func (*OpRequiresTxnError) Error

func (e *OpRequiresTxnError) Error() string

Error formats error.

func (*OpRequiresTxnError) Marshal

func (m *OpRequiresTxnError) Marshal() (data []byte, err error)

func (*OpRequiresTxnError) MarshalTo

func (m *OpRequiresTxnError) MarshalTo(data []byte) (int, error)

func (*OpRequiresTxnError) ProtoMessage

func (*OpRequiresTxnError) ProtoMessage()

func (*OpRequiresTxnError) Reset

func (m *OpRequiresTxnError) Reset()

func (*OpRequiresTxnError) Size

func (m *OpRequiresTxnError) Size() (n int)

func (*OpRequiresTxnError) Unmarshal

func (m *OpRequiresTxnError) Unmarshal(data []byte) error

type PushTxnRequest

type PushTxnRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// Transaction which encountered the intent, if applicable. For a
	// non-transactional operation, pusher_txn will be nil. Used to
	// compare priorities and timestamps if priorities are equal.
	PusherTxn Transaction `protobuf:"bytes,2,opt,name=pusher_txn" json:"pusher_txn"`
	// Transaction to be pushed, as specified at the intent which led to
	// the push transaction request. Note that this may not be the most
	// up-to-date value of the transaction record, but will be set or
	// merged as appropriate.
	PusheeTxn Transaction `protobuf:"bytes,3,opt,name=pushee_txn" json:"pushee_txn"`
	// PushTo is the timestamp just after which PusheeTxn is attempted to be
	// pushed. During conflict resolution, it should be set to the timestamp
	// of the its conflicting write.
	PushTo Timestamp `protobuf:"bytes,4,opt,name=push_to" json:"push_to"`
	// Now holds the timestamp used to compare the last heartbeat of the pushee
	// against. This is necessary since the request header's timestamp does not
	// necessarily advance with the node clock across retries and hence cannot
	// detect abandoned transactions.
	Now Timestamp `protobuf:"bytes,5,opt,name=now" json:"now"`
	// Readers set this to PUSH_TIMESTAMP to move PusheeTxn's commit
	// timestamp forward. Writers set this to ABORT_TXN to request that
	// the PushTxn be aborted if possible. This is done in the event of
	// a writer conflicting with PusheeTxn. Inconsistent readers set
	// this to CLEANUP_TXN to determine whether dangling intents
	// may be resolved.
	PushType PushTxnType `protobuf:"varint,6,opt,name=push_type,enum=cockroach.roachpb.PushTxnType" json:"push_type"`
}

A PushTxnRequest is arguments to the PushTxn() method. It's sent by readers or writers which have encountered an "intent" laid down by another transaction. The goal is to resolve the conflict. Note that args.Key should be set to the txn ID of args.PusheeTxn, not args.PusherTxn. This RPC is addressed to the range which owns the pushee's txn record. If the pusher is not transactional, it must be set to a Transaction record with only the Priority present.

Resolution is trivial if the txn which owns the intent has either been committed or aborted already. Otherwise, the existing txn can either be aborted (for write/write conflicts), or its commit timestamp can be moved forward (for read/write conflicts). The course of action is determined by the specified push type, and by the owning txn's status and priority.

func (*PushTxnRequest) CreateReply

func (*PushTxnRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*PushTxnRequest) Marshal

func (m *PushTxnRequest) Marshal() (data []byte, err error)

func (*PushTxnRequest) MarshalTo

func (m *PushTxnRequest) MarshalTo(data []byte) (int, error)

func (*PushTxnRequest) Method

func (*PushTxnRequest) Method() Method

Method implements the Request interface.

func (*PushTxnRequest) ProtoMessage

func (*PushTxnRequest) ProtoMessage()

func (*PushTxnRequest) Reset

func (m *PushTxnRequest) Reset()

func (*PushTxnRequest) Size

func (m *PushTxnRequest) Size() (n int)

func (*PushTxnRequest) String

func (m *PushTxnRequest) String() string

func (*PushTxnRequest) Unmarshal

func (m *PushTxnRequest) Unmarshal(data []byte) error

type PushTxnResponse

type PushTxnResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// pushee_txn is non-nil if the transaction was pushed and contains
	// the current value of the transaction.
	PusheeTxn *Transaction `protobuf:"bytes,2,opt,name=pushee_txn" json:"pushee_txn,omitempty"`
}

A PushTxnResponse is the return value from the PushTxn() method. It returns success and the resulting state of PusheeTxn if the conflict was resolved in favor of the caller; the caller should subsequently invoke ResolveIntent() on the conflicted key. It returns an error otherwise.

func (*PushTxnResponse) Marshal

func (m *PushTxnResponse) Marshal() (data []byte, err error)

func (*PushTxnResponse) MarshalTo

func (m *PushTxnResponse) MarshalTo(data []byte) (int, error)

func (*PushTxnResponse) ProtoMessage

func (*PushTxnResponse) ProtoMessage()

func (*PushTxnResponse) Reset

func (m *PushTxnResponse) Reset()

func (*PushTxnResponse) Size

func (m *PushTxnResponse) Size() (n int)

func (*PushTxnResponse) String

func (m *PushTxnResponse) String() string

func (*PushTxnResponse) Unmarshal

func (m *PushTxnResponse) Unmarshal(data []byte) error

type PushTxnType

type PushTxnType int32

TxnPushType determines what action to take when pushing a transaction.

const (
	// Push the timestamp forward if possible to accommodate a concurrent reader.
	PUSH_TIMESTAMP PushTxnType = 0
	// Abort the transaction if possible to accommodate a concurrent writer.
	ABORT_TXN PushTxnType = 1
	// Cleanup the transaction if already committed/aborted, or if too old.
	CLEANUP_TXN PushTxnType = 2
)

func (PushTxnType) Enum

func (x PushTxnType) Enum() *PushTxnType

func (PushTxnType) String

func (x PushTxnType) String() string

func (*PushTxnType) UnmarshalJSON

func (x *PushTxnType) UnmarshalJSON(data []byte) error

type PutRequest

type PutRequest struct {
	Span  `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Value Value `protobuf:"bytes,2,opt,name=value" json:"value"`
}

A PutRequest is the argument to the Put() method.

func (*PutRequest) CreateReply

func (*PutRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*PutRequest) Marshal

func (m *PutRequest) Marshal() (data []byte, err error)

func (*PutRequest) MarshalTo

func (m *PutRequest) MarshalTo(data []byte) (int, error)

func (*PutRequest) Method

func (*PutRequest) Method() Method

Method implements the Request interface.

func (*PutRequest) ProtoMessage

func (*PutRequest) ProtoMessage()

func (*PutRequest) Reset

func (m *PutRequest) Reset()

func (*PutRequest) Size

func (m *PutRequest) Size() (n int)

func (*PutRequest) String

func (m *PutRequest) String() string

func (*PutRequest) Unmarshal

func (m *PutRequest) Unmarshal(data []byte) error

type PutResponse

type PutResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A PutResponse is the return value from the Put() method.

func (*PutResponse) Marshal

func (m *PutResponse) Marshal() (data []byte, err error)

func (*PutResponse) MarshalTo

func (m *PutResponse) MarshalTo(data []byte) (int, error)

func (*PutResponse) ProtoMessage

func (*PutResponse) ProtoMessage()

func (*PutResponse) Reset

func (m *PutResponse) Reset()

func (*PutResponse) Size

func (m *PutResponse) Size() (n int)

func (*PutResponse) String

func (m *PutResponse) String() string

func (*PutResponse) Unmarshal

func (m *PutResponse) Unmarshal(data []byte) error

type RKey

type RKey Key

RKey denotes a Key whose local addressing has been accounted for.

func (RKey) AsRawKey

func (rk RKey) AsRawKey() Key

AsRawKey returns the RKey as a Key. This is to be used only in select situations in which an RKey is known to not contain a wrapped locally- addressed Key. Whenever the Key which created the RKey is still available, it should be used instead.

func (RKey) Equal

func (rk RKey) Equal(other []byte) bool

Equal checks for byte-wise equality.

func (RKey) Less

func (rk RKey) Less(otherRK RKey) bool

Less compares two RKeys.

func (RKey) Next

func (rk RKey) Next() RKey

Next returns the RKey that sorts immediately after the given one.

func (RKey) PrefixEnd

func (rk RKey) PrefixEnd() RKey

PrefixEnd determines the end key given key as a prefix, that is the key that sorts precisely behind all keys starting with prefix: "1" is added to the final byte and the carry propagated. The special cases of nil and KeyMin always returns KeyMax.

func (RKey) String

func (rk RKey) String() string

type RSpan

type RSpan struct {
	Key, EndKey RKey
}

RSpan is a key range with an inclusive start RKey and an exclusive end RKey.

func (RSpan) ContainsKey

func (rs RSpan) ContainsKey(key RKey) bool

ContainsKey returns whether this span contains the specified key.

func (RSpan) ContainsKeyRange

func (rs RSpan) ContainsKeyRange(start, end RKey) bool

ContainsKeyRange returns whether this span contains the specified key range from start (inclusive) to end (exclusive). If end is empty, returns ContainsKey(start).

func (RSpan) Intersect

func (rs RSpan) Intersect(desc *RangeDescriptor) (RSpan, error)

Intersect returns the intersection of the current span and the descriptor's range. Returns an error if the span and the descriptor's range do not overlap.

type RaftCommand

type RaftCommand struct {
	RangeID       RangeID           `protobuf:"varint,1,opt,name=range_id,casttype=RangeID" json:"range_id"`
	OriginReplica ReplicaDescriptor `protobuf:"bytes,2,opt,name=origin_replica" json:"origin_replica"`
	Cmd           BatchRequest      `protobuf:"bytes,3,opt,name=cmd" json:"cmd"`
}

A RaftCommand is a command which can be serialized and sent via raft.

func (*RaftCommand) Marshal

func (m *RaftCommand) Marshal() (data []byte, err error)

func (*RaftCommand) MarshalTo

func (m *RaftCommand) MarshalTo(data []byte) (int, error)

func (*RaftCommand) ProtoMessage

func (*RaftCommand) ProtoMessage()

func (*RaftCommand) Reset

func (m *RaftCommand) Reset()

func (*RaftCommand) Size

func (m *RaftCommand) Size() (n int)

func (*RaftCommand) String

func (m *RaftCommand) String() string

func (*RaftCommand) Unmarshal

func (m *RaftCommand) Unmarshal(data []byte) error

type RaftSnapshotData

type RaftSnapshotData struct {
	// The latest RangeDescriptor
	RangeDescriptor RangeDescriptor              `protobuf:"bytes,1,opt,name=range_descriptor" json:"range_descriptor"`
	KV              []*RaftSnapshotData_KeyValue `protobuf:"bytes,2,rep,name=KV" json:"KV,omitempty"`
}

RaftSnapshotData is the payload of a raftpb.Snapshot. It contains a raw copy of all of the range's data and metadata, including the raft log, sequence cache, etc.

func (*RaftSnapshotData) Marshal

func (m *RaftSnapshotData) Marshal() (data []byte, err error)

func (*RaftSnapshotData) MarshalTo

func (m *RaftSnapshotData) MarshalTo(data []byte) (int, error)

func (*RaftSnapshotData) ProtoMessage

func (*RaftSnapshotData) ProtoMessage()

func (*RaftSnapshotData) Reset

func (m *RaftSnapshotData) Reset()

func (*RaftSnapshotData) Size

func (m *RaftSnapshotData) Size() (n int)

func (*RaftSnapshotData) String

func (m *RaftSnapshotData) String() string

func (*RaftSnapshotData) Unmarshal

func (m *RaftSnapshotData) Unmarshal(data []byte) error

type RaftSnapshotData_KeyValue

type RaftSnapshotData_KeyValue struct {
	Key   []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

func (*RaftSnapshotData_KeyValue) Marshal

func (m *RaftSnapshotData_KeyValue) Marshal() (data []byte, err error)

func (*RaftSnapshotData_KeyValue) MarshalTo

func (m *RaftSnapshotData_KeyValue) MarshalTo(data []byte) (int, error)

func (*RaftSnapshotData_KeyValue) ProtoMessage

func (*RaftSnapshotData_KeyValue) ProtoMessage()

func (*RaftSnapshotData_KeyValue) Reset

func (m *RaftSnapshotData_KeyValue) Reset()

func (*RaftSnapshotData_KeyValue) Size

func (m *RaftSnapshotData_KeyValue) Size() (n int)

func (*RaftSnapshotData_KeyValue) String

func (m *RaftSnapshotData_KeyValue) String() string

func (*RaftSnapshotData_KeyValue) Unmarshal

func (m *RaftSnapshotData_KeyValue) Unmarshal(data []byte) error

type RaftTombstone

type RaftTombstone struct {
	NextReplicaID ReplicaID `protobuf:"varint,1,opt,name=next_replica_id,casttype=ReplicaID" json:"next_replica_id"`
}

RaftTombstone contains information about a replica that has been deleted.

func (*RaftTombstone) Marshal

func (m *RaftTombstone) Marshal() (data []byte, err error)

func (*RaftTombstone) MarshalTo

func (m *RaftTombstone) MarshalTo(data []byte) (int, error)

func (*RaftTombstone) ProtoMessage

func (*RaftTombstone) ProtoMessage()

func (*RaftTombstone) Reset

func (m *RaftTombstone) Reset()

func (*RaftTombstone) Size

func (m *RaftTombstone) Size() (n int)

func (*RaftTombstone) String

func (m *RaftTombstone) String() string

func (*RaftTombstone) Unmarshal

func (m *RaftTombstone) Unmarshal(data []byte) error

type RaftTruncatedState

type RaftTruncatedState struct {
	// The highest index that has been removed from the log.
	Index uint64 `protobuf:"varint,1,opt,name=index" json:"index"`
	// The term corresponding to 'index'.
	Term uint64 `protobuf:"varint,2,opt,name=term" json:"term"`
}

RaftTruncatedState contains metadata about the truncated portion of the raft log. Raft requires access to the term of the last truncated log entry even after the rest of the entry has been discarded.

func (*RaftTruncatedState) Marshal

func (m *RaftTruncatedState) Marshal() (data []byte, err error)

func (*RaftTruncatedState) MarshalTo

func (m *RaftTruncatedState) MarshalTo(data []byte) (int, error)

func (*RaftTruncatedState) ProtoMessage

func (*RaftTruncatedState) ProtoMessage()

func (*RaftTruncatedState) Reset

func (m *RaftTruncatedState) Reset()

func (*RaftTruncatedState) Size

func (m *RaftTruncatedState) Size() (n int)

func (*RaftTruncatedState) String

func (m *RaftTruncatedState) String() string

func (*RaftTruncatedState) Unmarshal

func (m *RaftTruncatedState) Unmarshal(data []byte) error

type RangeDescriptor

type RangeDescriptor struct {
	RangeID RangeID `protobuf:"varint,1,opt,name=range_id,casttype=RangeID" json:"range_id"`
	// start_key is the first key which may be contained by this range.
	StartKey RKey `protobuf:"bytes,2,opt,name=start_key,casttype=RKey" json:"start_key,omitempty"`
	// end_key marks the end of the range's possible keys.  EndKey itself is not
	// contained in this range - it will be contained in the immediately
	// subsequent range.
	EndKey RKey `protobuf:"bytes,3,opt,name=end_key,casttype=RKey" json:"end_key,omitempty"`
	// replicas is the set of nodes/stores on which replicas of this
	// range are stored, the ordering being arbitrary and subject to
	// permutation.
	Replicas []ReplicaDescriptor `protobuf:"bytes,4,rep,name=replicas" json:"replicas"`
	// next_replica_id is a counter used to generate replica IDs.
	NextReplicaID ReplicaID `protobuf:"varint,5,opt,name=next_replica_id,casttype=ReplicaID" json:"next_replica_id"`
}

RangeDescriptor is the value stored in a range metadata key. A range is described using an inclusive start key, a non-inclusive end key, and a list of replicas where the range is stored.

func (*RangeDescriptor) ContainsKey

func (r *RangeDescriptor) ContainsKey(key RKey) bool

ContainsKey returns whether this RangeDescriptor contains the specified key.

func (*RangeDescriptor) ContainsKeyRange

func (r *RangeDescriptor) ContainsKeyRange(start, end RKey) bool

ContainsKeyRange returns whether this RangeDescriptor contains the specified key range from start (inclusive) to end (exclusive). If end is empty, returns ContainsKey(start).

func (*RangeDescriptor) FindReplica

func (r *RangeDescriptor) FindReplica(storeID StoreID) (int, *ReplicaDescriptor)

FindReplica returns the replica which matches the specified store ID. If no replica matches, (-1, nil) is returned.

func (*RangeDescriptor) Marshal

func (m *RangeDescriptor) Marshal() (data []byte, err error)

func (*RangeDescriptor) MarshalTo

func (m *RangeDescriptor) MarshalTo(data []byte) (int, error)

func (*RangeDescriptor) ProtoMessage

func (*RangeDescriptor) ProtoMessage()

func (*RangeDescriptor) Reset

func (m *RangeDescriptor) Reset()

func (*RangeDescriptor) Size

func (m *RangeDescriptor) Size() (n int)

func (*RangeDescriptor) String

func (m *RangeDescriptor) String() string

func (*RangeDescriptor) Unmarshal

func (m *RangeDescriptor) Unmarshal(data []byte) error

func (*RangeDescriptor) Validate

func (r *RangeDescriptor) Validate() error

Validate performs some basic validation of the contents of a range descriptor.

type RangeID

type RangeID int64

A RangeID is a unique ID associated to a Raft consensus group.

func (RangeID) String

func (r RangeID) String() string

String implements the fmt.Stringer interface.

type RangeIDSlice

type RangeIDSlice []RangeID

RangeIDSlice implements sort.Interface.

func (RangeIDSlice) Len

func (r RangeIDSlice) Len() int

func (RangeIDSlice) Less

func (r RangeIDSlice) Less(i, j int) bool

func (RangeIDSlice) Swap

func (r RangeIDSlice) Swap(i, j int)

type RangeKeyMismatchError

type RangeKeyMismatchError struct {
	RequestStartKey Key              `protobuf:"bytes,1,opt,name=request_start_key,casttype=Key" json:"request_start_key,omitempty"`
	RequestEndKey   Key              `protobuf:"bytes,2,opt,name=request_end_key,casttype=Key" json:"request_end_key,omitempty"`
	Range           *RangeDescriptor `protobuf:"bytes,3,opt,name=range" json:"range,omitempty"`
}

A RangeKeyMismatchError indicates that a command was sent to a range which did not contain the key(s) specified by the command.

func NewRangeKeyMismatchError

func NewRangeKeyMismatchError(start, end Key, desc *RangeDescriptor) *RangeKeyMismatchError

NewRangeKeyMismatchError initializes a new RangeKeyMismatchError.

func (*RangeKeyMismatchError) CanRetry

func (e *RangeKeyMismatchError) CanRetry() bool

CanRetry indicates whether or not this RangeKeyMismatchError can be retried.

func (*RangeKeyMismatchError) Error

func (e *RangeKeyMismatchError) Error() string

Error formats error.

func (*RangeKeyMismatchError) Marshal

func (m *RangeKeyMismatchError) Marshal() (data []byte, err error)

func (*RangeKeyMismatchError) MarshalTo

func (m *RangeKeyMismatchError) MarshalTo(data []byte) (int, error)

func (*RangeKeyMismatchError) ProtoMessage

func (*RangeKeyMismatchError) ProtoMessage()

func (*RangeKeyMismatchError) Reset

func (m *RangeKeyMismatchError) Reset()

func (*RangeKeyMismatchError) Size

func (m *RangeKeyMismatchError) Size() (n int)

func (*RangeKeyMismatchError) Unmarshal

func (m *RangeKeyMismatchError) Unmarshal(data []byte) error

type RangeLookupRequest

type RangeLookupRequest struct {
	Span      `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	MaxRanges int32 `protobuf:"varint,2,opt,name=max_ranges" json:"max_ranges"`
	// consider_intents indicates whether or not intents encountered
	// while looking up the range info should randomly be returned
	// to the caller. This is intended to be used when retrying due
	// to range addressing errors.
	ConsiderIntents bool `protobuf:"varint,3,opt,name=consider_intents" json:"consider_intents"`
	// Use a reverse scan to pre-fill the range descriptor cache instead
	// of an ascending scan.
	Reverse bool `protobuf:"varint,4,opt,name=reverse" json:"reverse"`
}

A RangeLookupRequest is arguments to the RangeLookup() method. A forward lookup request returns a range containing the requested key. A reverse lookup request returns a range containing the previous key of the requested key (e.g., if a requested key is the end key of range R, the reverse lookup request returns R).

RangeLookupRequest also specifies the maximum number of range descriptors that should be returned, if there are additional consecutive addressable ranges. Specify max_ranges > 1 to pre-fill the range descriptor cache. The additional ranges are scanned in the same direction as lookup (forward v.s. reverse).

func (*RangeLookupRequest) CreateReply

func (*RangeLookupRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*RangeLookupRequest) Marshal

func (m *RangeLookupRequest) Marshal() (data []byte, err error)

func (*RangeLookupRequest) MarshalTo

func (m *RangeLookupRequest) MarshalTo(data []byte) (int, error)

func (*RangeLookupRequest) Method

func (*RangeLookupRequest) Method() Method

Method implements the Request interface.

func (*RangeLookupRequest) ProtoMessage

func (*RangeLookupRequest) ProtoMessage()

func (*RangeLookupRequest) Reset

func (m *RangeLookupRequest) Reset()

func (*RangeLookupRequest) Size

func (m *RangeLookupRequest) Size() (n int)

func (*RangeLookupRequest) String

func (m *RangeLookupRequest) String() string

func (*RangeLookupRequest) Unmarshal

func (m *RangeLookupRequest) Unmarshal(data []byte) error

type RangeLookupResponse

type RangeLookupResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	Ranges         []RangeDescriptor `protobuf:"bytes,2,rep,name=ranges" json:"ranges"`
}

A RangeLookupResponse is the return value from the RangeLookup() method. It returns metadata for the range containing the requested key, optionally returning the metadata for additional consecutive ranges beyond the requested range to pre-fill the range descriptor cache.

func (*RangeLookupResponse) Marshal

func (m *RangeLookupResponse) Marshal() (data []byte, err error)

func (*RangeLookupResponse) MarshalTo

func (m *RangeLookupResponse) MarshalTo(data []byte) (int, error)

func (*RangeLookupResponse) ProtoMessage

func (*RangeLookupResponse) ProtoMessage()

func (*RangeLookupResponse) Reset

func (m *RangeLookupResponse) Reset()

func (*RangeLookupResponse) Size

func (m *RangeLookupResponse) Size() (n int)

func (*RangeLookupResponse) String

func (m *RangeLookupResponse) String() string

func (*RangeLookupResponse) Unmarshal

func (m *RangeLookupResponse) Unmarshal(data []byte) error

type RangeNotFoundError

type RangeNotFoundError struct {
	RangeID RangeID `protobuf:"varint,1,opt,name=range_id,casttype=RangeID" json:"range_id"`
}

A RangeNotFoundError indicates that a command was sent to a range which is not hosted on this store.

func NewRangeNotFoundError

func NewRangeNotFoundError(rangeID RangeID) *RangeNotFoundError

NewRangeNotFoundError initializes a new RangeNotFoundError.

func (*RangeNotFoundError) CanRetry

func (e *RangeNotFoundError) CanRetry() bool

CanRetry indicates whether or not this RangeNotFoundError can be retried.

func (*RangeNotFoundError) Error

func (e *RangeNotFoundError) Error() string

Error formats error.

func (*RangeNotFoundError) Marshal

func (m *RangeNotFoundError) Marshal() (data []byte, err error)

func (*RangeNotFoundError) MarshalTo

func (m *RangeNotFoundError) MarshalTo(data []byte) (int, error)

func (*RangeNotFoundError) ProtoMessage

func (*RangeNotFoundError) ProtoMessage()

func (*RangeNotFoundError) Reset

func (m *RangeNotFoundError) Reset()

func (*RangeNotFoundError) Size

func (m *RangeNotFoundError) Size() (n int)

func (*RangeNotFoundError) Unmarshal

func (m *RangeNotFoundError) Unmarshal(data []byte) error

type RangeTree

type RangeTree struct {
	RootKey RKey `protobuf:"bytes,1,opt,name=root_key,casttype=RKey" json:"root_key,omitempty"`
}

RangeTree holds the root node of the range tree.

func (*RangeTree) Marshal

func (m *RangeTree) Marshal() (data []byte, err error)

func (*RangeTree) MarshalTo

func (m *RangeTree) MarshalTo(data []byte) (int, error)

func (*RangeTree) ProtoMessage

func (*RangeTree) ProtoMessage()

func (*RangeTree) Reset

func (m *RangeTree) Reset()

func (*RangeTree) Size

func (m *RangeTree) Size() (n int)

func (*RangeTree) String

func (m *RangeTree) String() string

func (*RangeTree) Unmarshal

func (m *RangeTree) Unmarshal(data []byte) error

type RangeTreeNode

type RangeTreeNode struct {
	Key RKey `protobuf:"bytes,1,opt,name=key,casttype=RKey" json:"key,omitempty"`
	// Color is black if true, red if false.
	Black bool `protobuf:"varint,2,opt,name=black" json:"black"`
	// If the parent key is null, this is the root node.
	ParentKey RKey `protobuf:"bytes,3,opt,name=parent_key,casttype=RKey" json:"parent_key,omitempty"`
	LeftKey   RKey `protobuf:"bytes,4,opt,name=left_key,casttype=RKey" json:"left_key,omitempty"`
	RightKey  RKey `protobuf:"bytes,5,opt,name=right_key,casttype=RKey" json:"right_key,omitempty"`
}

RangeTreeNode holds the configuration for each node of the Red-Black Tree that references all ranges.

func (*RangeTreeNode) Marshal

func (m *RangeTreeNode) Marshal() (data []byte, err error)

func (*RangeTreeNode) MarshalTo

func (m *RangeTreeNode) MarshalTo(data []byte) (int, error)

func (*RangeTreeNode) ProtoMessage

func (*RangeTreeNode) ProtoMessage()

func (*RangeTreeNode) Reset

func (m *RangeTreeNode) Reset()

func (*RangeTreeNode) Size

func (m *RangeTreeNode) Size() (n int)

func (*RangeTreeNode) String

func (m *RangeTreeNode) String() string

func (*RangeTreeNode) Unmarshal

func (m *RangeTreeNode) Unmarshal(data []byte) error

type ReadConsistencyType

type ReadConsistencyType int32

ReadConsistencyType specifies what type of consistency is observed during read operations.

const (
	// CONSISTENT reads are guaranteed to read committed data; the
	// mechanism relies on clocks to determine lease expirations.
	CONSISTENT ReadConsistencyType = 0
	// CONSENSUS requires that reads must achieve consensus. This is a
	// stronger guarantee of consistency than CONSISTENT.
	//
	// TODO(spencer): current unimplemented.
	CONSENSUS ReadConsistencyType = 1
	// INCONSISTENT reads return the latest available, committed values.
	// They are more efficient, but may read stale values as pending
	// intents are ignored.
	INCONSISTENT ReadConsistencyType = 2
)

func (ReadConsistencyType) Enum

func (ReadConsistencyType) String

func (x ReadConsistencyType) String() string

func (*ReadConsistencyType) UnmarshalJSON

func (x *ReadConsistencyType) UnmarshalJSON(data []byte) error

type ReadWithinUncertaintyIntervalError

type ReadWithinUncertaintyIntervalError struct {
	Timestamp         Timestamp   `protobuf:"bytes,1,opt,name=timestamp" json:"timestamp"`
	ExistingTimestamp Timestamp   `protobuf:"bytes,2,opt,name=existing_timestamp" json:"existing_timestamp"`
	NodeID            NodeID      `protobuf:"varint,3,opt,name=node_id,casttype=NodeID" json:"node_id"`
	Txn               Transaction `protobuf:"bytes,4,opt,name=txn" json:"txn"`
}

A ReadWithinUncertaintyIntervalError indicates that a read at timestamp encountered a versioned value at existing_timestamp within the uncertainty interval of the reader. The read should be retried at existing_timestamp+1.

func (*ReadWithinUncertaintyIntervalError) CanRestartTransaction

func (e *ReadWithinUncertaintyIntervalError) CanRestartTransaction() TransactionRestart

CanRestartTransaction implements the TransactionRestartError interface.

func (*ReadWithinUncertaintyIntervalError) Error

Error formats error.

func (*ReadWithinUncertaintyIntervalError) Marshal

func (m *ReadWithinUncertaintyIntervalError) Marshal() (data []byte, err error)

func (*ReadWithinUncertaintyIntervalError) MarshalTo

func (m *ReadWithinUncertaintyIntervalError) MarshalTo(data []byte) (int, error)

func (*ReadWithinUncertaintyIntervalError) ProtoMessage

func (*ReadWithinUncertaintyIntervalError) ProtoMessage()

func (*ReadWithinUncertaintyIntervalError) Reset

func (*ReadWithinUncertaintyIntervalError) Size

func (*ReadWithinUncertaintyIntervalError) Transaction

Transaction implements the TransactionRestartError interface.

func (*ReadWithinUncertaintyIntervalError) Unmarshal

func (m *ReadWithinUncertaintyIntervalError) Unmarshal(data []byte) error

type ReplicaChangeType

type ReplicaChangeType int32

ReplicaChangeType is a parameter of ChangeReplicasTrigger.

const (
	ADD_REPLICA    ReplicaChangeType = 0
	REMOVE_REPLICA ReplicaChangeType = 1
)

func (ReplicaChangeType) Enum

func (ReplicaChangeType) String

func (x ReplicaChangeType) String() string

func (*ReplicaChangeType) UnmarshalJSON

func (x *ReplicaChangeType) UnmarshalJSON(data []byte) error

type ReplicaDescriptor

type ReplicaDescriptor struct {
	NodeID  NodeID  `protobuf:"varint,1,opt,name=node_id,casttype=NodeID" json:"node_id"`
	StoreID StoreID `protobuf:"varint,2,opt,name=store_id,casttype=StoreID" json:"store_id"`
	// replica_id uniquely identifies a replica instance. If a range is removed from
	// a store and then re-added to the same store, the new instance will have a
	// higher replica_id.
	ReplicaID ReplicaID `protobuf:"varint,3,opt,name=replica_id,casttype=ReplicaID" json:"replica_id"`
}

ReplicaDescriptor describes a replica location by node ID (corresponds to a host:port via lookup on gossip network) and store ID (identifies the device).

func (*ReplicaDescriptor) Marshal

func (m *ReplicaDescriptor) Marshal() (data []byte, err error)

func (*ReplicaDescriptor) MarshalTo

func (m *ReplicaDescriptor) MarshalTo(data []byte) (int, error)

func (*ReplicaDescriptor) ProtoMessage

func (*ReplicaDescriptor) ProtoMessage()

func (*ReplicaDescriptor) Reset

func (m *ReplicaDescriptor) Reset()

func (*ReplicaDescriptor) Size

func (m *ReplicaDescriptor) Size() (n int)

func (*ReplicaDescriptor) String

func (m *ReplicaDescriptor) String() string

func (*ReplicaDescriptor) Unmarshal

func (m *ReplicaDescriptor) Unmarshal(data []byte) error

func (ReplicaDescriptor) Validate

func (r ReplicaDescriptor) Validate() error

Validate performs some basic validation of the contents of a replica descriptor.

type ReplicaID

type ReplicaID int32

ReplicaID is a custom type for a range replica ID.

func (ReplicaID) String

func (r ReplicaID) String() string

String implements the fmt.Stringer interface.

type Request

type Request interface {
	proto.Message
	// Header returns the request header.
	Header() *Span
	// Method returns the request method.
	Method() Method
	// CreateReply creates a new response object.
	CreateReply() Response
	// contains filtered or unexported methods
}

Request is an interface for RPC requests.

func NewConditionalPut

func NewConditionalPut(key Key, value, expValue Value) Request

NewConditionalPut returns a Request initialized to put value as a byte slice at key if the existing value at key equals expValueBytes.

func NewDelete

func NewDelete(key Key) Request

NewDelete returns a Request initialized to delete the value at key.

func NewDeleteRange

func NewDeleteRange(startKey, endKey Key) Request

NewDeleteRange returns a Request initialized to delete the values in the given key range (excluding the endpoint).

func NewGet

func NewGet(key Key) Request

NewGet returns a Request initialized to get the value at key.

func NewIncrement

func NewIncrement(key Key, increment int64) Request

NewIncrement returns a Request initialized to increment the value at key by increment.

func NewPut

func NewPut(key Key, value Value) Request

NewPut returns a Request initialized to put the value at key.

func NewReverseScan

func NewReverseScan(key, endKey Key, maxResults int64) Request

NewReverseScan returns a Request initialized to reverse scan from end to start keys with max results.

func NewScan

func NewScan(key, endKey Key, maxResults int64) Request

NewScan returns a Request initialized to scan from start to end keys with max results.

type RequestUnion

type RequestUnion struct {
	Get                *GetRequest                `protobuf:"bytes,1,opt,name=get" json:"get,omitempty"`
	Put                *PutRequest                `protobuf:"bytes,2,opt,name=put" json:"put,omitempty"`
	ConditionalPut     *ConditionalPutRequest     `protobuf:"bytes,3,opt,name=conditional_put" json:"conditional_put,omitempty"`
	Increment          *IncrementRequest          `protobuf:"bytes,4,opt,name=increment" json:"increment,omitempty"`
	Delete             *DeleteRequest             `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"`
	DeleteRange        *DeleteRangeRequest        `protobuf:"bytes,6,opt,name=delete_range" json:"delete_range,omitempty"`
	Scan               *ScanRequest               `protobuf:"bytes,7,opt,name=scan" json:"scan,omitempty"`
	BeginTransaction   *BeginTransactionRequest   `protobuf:"bytes,8,opt,name=begin_transaction" json:"begin_transaction,omitempty"`
	EndTransaction     *EndTransactionRequest     `protobuf:"bytes,9,opt,name=end_transaction" json:"end_transaction,omitempty"`
	AdminSplit         *AdminSplitRequest         `protobuf:"bytes,10,opt,name=admin_split" json:"admin_split,omitempty"`
	AdminMerge         *AdminMergeRequest         `protobuf:"bytes,11,opt,name=admin_merge" json:"admin_merge,omitempty"`
	HeartbeatTxn       *HeartbeatTxnRequest       `protobuf:"bytes,12,opt,name=heartbeat_txn" json:"heartbeat_txn,omitempty"`
	Gc                 *GCRequest                 `protobuf:"bytes,13,opt,name=gc" json:"gc,omitempty"`
	PushTxn            *PushTxnRequest            `protobuf:"bytes,14,opt,name=push_txn" json:"push_txn,omitempty"`
	RangeLookup        *RangeLookupRequest        `protobuf:"bytes,15,opt,name=range_lookup" json:"range_lookup,omitempty"`
	ResolveIntent      *ResolveIntentRequest      `protobuf:"bytes,16,opt,name=resolve_intent" json:"resolve_intent,omitempty"`
	ResolveIntentRange *ResolveIntentRangeRequest `protobuf:"bytes,17,opt,name=resolve_intent_range" json:"resolve_intent_range,omitempty"`
	Merge              *MergeRequest              `protobuf:"bytes,18,opt,name=merge" json:"merge,omitempty"`
	TruncateLog        *TruncateLogRequest        `protobuf:"bytes,19,opt,name=truncate_log" json:"truncate_log,omitempty"`
	LeaderLease        *LeaderLeaseRequest        `protobuf:"bytes,20,opt,name=leader_lease" json:"leader_lease,omitempty"`
	ReverseScan        *ReverseScanRequest        `protobuf:"bytes,21,opt,name=reverse_scan" json:"reverse_scan,omitempty"`
	Noop               *NoopRequest               `protobuf:"bytes,22,opt,name=noop" json:"noop,omitempty"`
}

A RequestUnion contains exactly one of the optional requests. The values added here must match those in ResponseUnion.

func (RequestUnion) GetInner

func (ru RequestUnion) GetInner() Request

GetInner returns the Request contained in the union.

func (*RequestUnion) GetValue

func (this *RequestUnion) GetValue() interface{}

func (*RequestUnion) Marshal

func (m *RequestUnion) Marshal() (data []byte, err error)

func (*RequestUnion) MarshalTo

func (m *RequestUnion) MarshalTo(data []byte) (int, error)

func (*RequestUnion) ProtoMessage

func (*RequestUnion) ProtoMessage()

func (*RequestUnion) Reset

func (m *RequestUnion) Reset()

func (*RequestUnion) SetValue

func (this *RequestUnion) SetValue(value interface{}) bool

func (*RequestUnion) Size

func (m *RequestUnion) Size() (n int)

func (*RequestUnion) String

func (m *RequestUnion) String() string

func (*RequestUnion) Unmarshal

func (m *RequestUnion) Unmarshal(data []byte) error

type ResolveIntentRangeRequest

type ResolveIntentRangeRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// The transaction whose intents are being resolved.
	IntentTxn Transaction `protobuf:"bytes,2,opt,name=intent_txn" json:"intent_txn"`
}

A ResolveIntentRangeRequest is arguments to the ResolveIntentRange() method. It is sent by transaction coordinators after success calling PushTxn to clean up write intents: either to remove, commit or move them forward in time.

func (*ResolveIntentRangeRequest) CreateReply

func (*ResolveIntentRangeRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*ResolveIntentRangeRequest) Marshal

func (m *ResolveIntentRangeRequest) Marshal() (data []byte, err error)

func (*ResolveIntentRangeRequest) MarshalTo

func (m *ResolveIntentRangeRequest) MarshalTo(data []byte) (int, error)

func (*ResolveIntentRangeRequest) Method

Method implements the Request interface.

func (*ResolveIntentRangeRequest) ProtoMessage

func (*ResolveIntentRangeRequest) ProtoMessage()

func (*ResolveIntentRangeRequest) Reset

func (m *ResolveIntentRangeRequest) Reset()

func (*ResolveIntentRangeRequest) Size

func (m *ResolveIntentRangeRequest) Size() (n int)

func (*ResolveIntentRangeRequest) String

func (m *ResolveIntentRangeRequest) String() string

func (*ResolveIntentRangeRequest) Unmarshal

func (m *ResolveIntentRangeRequest) Unmarshal(data []byte) error

type ResolveIntentRangeResponse

type ResolveIntentRangeResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A ResolveIntentRangeResponse is the return value from the ResolveIntent() method.

func (*ResolveIntentRangeResponse) Combine

func (rr *ResolveIntentRangeResponse) Combine(c Response) error

Combine implements the Combinable interface.

func (*ResolveIntentRangeResponse) Marshal

func (m *ResolveIntentRangeResponse) Marshal() (data []byte, err error)

func (*ResolveIntentRangeResponse) MarshalTo

func (m *ResolveIntentRangeResponse) MarshalTo(data []byte) (int, error)

func (*ResolveIntentRangeResponse) ProtoMessage

func (*ResolveIntentRangeResponse) ProtoMessage()

func (*ResolveIntentRangeResponse) Reset

func (m *ResolveIntentRangeResponse) Reset()

func (*ResolveIntentRangeResponse) Size

func (m *ResolveIntentRangeResponse) Size() (n int)

func (*ResolveIntentRangeResponse) String

func (m *ResolveIntentRangeResponse) String() string

func (*ResolveIntentRangeResponse) Unmarshal

func (m *ResolveIntentRangeResponse) Unmarshal(data []byte) error

type ResolveIntentRequest

type ResolveIntentRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// The transaction whose intent is being resolved.
	IntentTxn Transaction `protobuf:"bytes,2,opt,name=intent_txn" json:"intent_txn"`
}

A ResolveIntentRequest is arguments to the ResolveIntent() method. It is sent by transaction coordinators after success calling PushTxn to clean up write intents: either to remove, commit or move them forward in time.

func (*ResolveIntentRequest) CreateReply

func (*ResolveIntentRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*ResolveIntentRequest) Marshal

func (m *ResolveIntentRequest) Marshal() (data []byte, err error)

func (*ResolveIntentRequest) MarshalTo

func (m *ResolveIntentRequest) MarshalTo(data []byte) (int, error)

func (*ResolveIntentRequest) Method

func (*ResolveIntentRequest) Method() Method

Method implements the Request interface.

func (*ResolveIntentRequest) ProtoMessage

func (*ResolveIntentRequest) ProtoMessage()

func (*ResolveIntentRequest) Reset

func (m *ResolveIntentRequest) Reset()

func (*ResolveIntentRequest) Size

func (m *ResolveIntentRequest) Size() (n int)

func (*ResolveIntentRequest) String

func (m *ResolveIntentRequest) String() string

func (*ResolveIntentRequest) Unmarshal

func (m *ResolveIntentRequest) Unmarshal(data []byte) error

type ResolveIntentResponse

type ResolveIntentResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

A ResolveIntentResponse is the return value from the ResolveIntent() method.

func (*ResolveIntentResponse) Marshal

func (m *ResolveIntentResponse) Marshal() (data []byte, err error)

func (*ResolveIntentResponse) MarshalTo

func (m *ResolveIntentResponse) MarshalTo(data []byte) (int, error)

func (*ResolveIntentResponse) ProtoMessage

func (*ResolveIntentResponse) ProtoMessage()

func (*ResolveIntentResponse) Reset

func (m *ResolveIntentResponse) Reset()

func (*ResolveIntentResponse) Size

func (m *ResolveIntentResponse) Size() (n int)

func (*ResolveIntentResponse) String

func (m *ResolveIntentResponse) String() string

func (*ResolveIntentResponse) Unmarshal

func (m *ResolveIntentResponse) Unmarshal(data []byte) error

type Response

type Response interface {
	proto.Message
	// Header returns the response header.
	Header() *ResponseHeader
	// Verify verifies response integrity, as applicable.
	Verify(req Request) error
}

Response is an interface for RPC responses.

type ResponseHeader

type ResponseHeader struct {
	// timestamp specifies time at which read or write actually was
	// performed. In the case of both reads and writes, if the timestamp
	// supplied to the request was 0, the wall time of the node
	// servicing the request will be set here. Additionally, in the case
	// of writes, this value may be increased from the timestamp passed
	// with the Span if the key being written was either read
	// or written more recently.
	Timestamp Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp"`
	// txn is non-nil if the request specified a non-nil transaction.
	// The transaction timestamp and/or priority may have been updated,
	// depending on the outcome of the request.
	Txn *Transaction `protobuf:"bytes,3,opt,name=txn" json:"txn,omitempty"`
}

ResponseHeader is returned with every storage node response.

func (*ResponseHeader) Combine

func (rh *ResponseHeader) Combine(otherRH *ResponseHeader) error

Combine is used by range-spanning Response types (e.g. Scan or DeleteRange) to merge their headers.

func (*ResponseHeader) Header

func (rh *ResponseHeader) Header() *ResponseHeader

Header implements the Response interface for ResponseHeader.

func (*ResponseHeader) Marshal

func (m *ResponseHeader) Marshal() (data []byte, err error)

func (*ResponseHeader) MarshalTo

func (m *ResponseHeader) MarshalTo(data []byte) (int, error)

func (*ResponseHeader) ProtoMessage

func (*ResponseHeader) ProtoMessage()

func (*ResponseHeader) Reset

func (m *ResponseHeader) Reset()

func (*ResponseHeader) Size

func (m *ResponseHeader) Size() (n int)

func (*ResponseHeader) String

func (m *ResponseHeader) String() string

func (*ResponseHeader) Unmarshal

func (m *ResponseHeader) Unmarshal(data []byte) error

func (*ResponseHeader) Verify

func (rh *ResponseHeader) Verify(req Request) error

Verify implements the Response interface for ResopnseHeader with a default noop. Individual response types should override this method if they contain checksummed data which can be verified.

type ResponseUnion

type ResponseUnion struct {
	Get                *GetResponse                `protobuf:"bytes,1,opt,name=get" json:"get,omitempty"`
	Put                *PutResponse                `protobuf:"bytes,2,opt,name=put" json:"put,omitempty"`
	ConditionalPut     *ConditionalPutResponse     `protobuf:"bytes,3,opt,name=conditional_put" json:"conditional_put,omitempty"`
	Increment          *IncrementResponse          `protobuf:"bytes,4,opt,name=increment" json:"increment,omitempty"`
	Delete             *DeleteResponse             `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"`
	DeleteRange        *DeleteRangeResponse        `protobuf:"bytes,6,opt,name=delete_range" json:"delete_range,omitempty"`
	Scan               *ScanResponse               `protobuf:"bytes,7,opt,name=scan" json:"scan,omitempty"`
	BeginTransaction   *BeginTransactionResponse   `protobuf:"bytes,8,opt,name=begin_transaction" json:"begin_transaction,omitempty"`
	EndTransaction     *EndTransactionResponse     `protobuf:"bytes,9,opt,name=end_transaction" json:"end_transaction,omitempty"`
	AdminSplit         *AdminSplitResponse         `protobuf:"bytes,10,opt,name=admin_split" json:"admin_split,omitempty"`
	AdminMerge         *AdminMergeResponse         `protobuf:"bytes,11,opt,name=admin_merge" json:"admin_merge,omitempty"`
	HeartbeatTxn       *HeartbeatTxnResponse       `protobuf:"bytes,12,opt,name=heartbeat_txn" json:"heartbeat_txn,omitempty"`
	Gc                 *GCResponse                 `protobuf:"bytes,13,opt,name=gc" json:"gc,omitempty"`
	PushTxn            *PushTxnResponse            `protobuf:"bytes,14,opt,name=push_txn" json:"push_txn,omitempty"`
	RangeLookup        *RangeLookupResponse        `protobuf:"bytes,15,opt,name=range_lookup" json:"range_lookup,omitempty"`
	ResolveIntent      *ResolveIntentResponse      `protobuf:"bytes,16,opt,name=resolve_intent" json:"resolve_intent,omitempty"`
	ResolveIntentRange *ResolveIntentRangeResponse `protobuf:"bytes,17,opt,name=resolve_intent_range" json:"resolve_intent_range,omitempty"`
	Merge              *MergeResponse              `protobuf:"bytes,18,opt,name=merge" json:"merge,omitempty"`
	TruncateLog        *TruncateLogResponse        `protobuf:"bytes,19,opt,name=truncate_log" json:"truncate_log,omitempty"`
	LeaderLease        *LeaderLeaseResponse        `protobuf:"bytes,20,opt,name=leader_lease" json:"leader_lease,omitempty"`
	ReverseScan        *ReverseScanResponse        `protobuf:"bytes,21,opt,name=reverse_scan" json:"reverse_scan,omitempty"`
	Noop               *NoopResponse               `protobuf:"bytes,22,opt,name=noop" json:"noop,omitempty"`
}

A ResponseUnion contains exactly one of the optional responses. The values added here must match those in RequestUnion.

func (ResponseUnion) GetInner

func (ru ResponseUnion) GetInner() Response

GetInner returns the Response contained in the union.

func (*ResponseUnion) GetValue

func (this *ResponseUnion) GetValue() interface{}

func (*ResponseUnion) Marshal

func (m *ResponseUnion) Marshal() (data []byte, err error)

func (*ResponseUnion) MarshalTo

func (m *ResponseUnion) MarshalTo(data []byte) (int, error)

func (*ResponseUnion) ProtoMessage

func (*ResponseUnion) ProtoMessage()

func (*ResponseUnion) Reset

func (m *ResponseUnion) Reset()

func (*ResponseUnion) SetValue

func (this *ResponseUnion) SetValue(value interface{}) bool

func (*ResponseUnion) Size

func (m *ResponseUnion) Size() (n int)

func (*ResponseUnion) String

func (m *ResponseUnion) String() string

func (*ResponseUnion) Unmarshal

func (m *ResponseUnion) Unmarshal(data []byte) error

type ResponseWithError

type ResponseWithError struct {
	Reply *BatchResponse
	Err   error
}

ResponseWithError is a tuple of a BatchResponse and an error. It is used to pass around a BatchResponse with its associated error where that entanglement is necessary (e.g. channels, methods that need to return another error in addition to this one).

type ReverseScanRequest

type ReverseScanRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// If 0, there is no limit on the number of retrieved entries. Must be >= 0.
	MaxResults int64 `protobuf:"varint,2,opt,name=max_results" json:"max_results"`
}

A ReverseScanRequest is the argument to the ReverseScan() method. It specifies the start and end keys for a descending scan of [start,end) and the maximum number of results.

func (*ReverseScanRequest) CreateReply

func (*ReverseScanRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*ReverseScanRequest) GetBound

func (sr *ReverseScanRequest) GetBound() int64

GetBound returns the MaxResults field in ReverseScanRequest.

func (*ReverseScanRequest) Marshal

func (m *ReverseScanRequest) Marshal() (data []byte, err error)

func (*ReverseScanRequest) MarshalTo

func (m *ReverseScanRequest) MarshalTo(data []byte) (int, error)

func (*ReverseScanRequest) Method

func (*ReverseScanRequest) Method() Method

Method implements the Request interface.

func (*ReverseScanRequest) ProtoMessage

func (*ReverseScanRequest) ProtoMessage()

func (*ReverseScanRequest) Reset

func (m *ReverseScanRequest) Reset()

func (*ReverseScanRequest) SetBound

func (sr *ReverseScanRequest) SetBound(bound int64)

SetBound sets the MaxResults field in ReverseScanRequest.

func (*ReverseScanRequest) Size

func (m *ReverseScanRequest) Size() (n int)

func (*ReverseScanRequest) String

func (m *ReverseScanRequest) String() string

func (*ReverseScanRequest) Unmarshal

func (m *ReverseScanRequest) Unmarshal(data []byte) error

type ReverseScanResponse

type ReverseScanResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// Empty if no rows were scanned.
	Rows []KeyValue `protobuf:"bytes,2,rep,name=rows" json:"rows"`
}

A ReverseScanResponse is the return value from the ReverseScan() method.

func (*ReverseScanResponse) Combine

func (sr *ReverseScanResponse) Combine(c Response) error

Combine implements the Combinable interface.

func (*ReverseScanResponse) Count

func (sr *ReverseScanResponse) Count() int64

Count returns the number of rows in ReverseScanResponse.

func (*ReverseScanResponse) Marshal

func (m *ReverseScanResponse) Marshal() (data []byte, err error)

func (*ReverseScanResponse) MarshalTo

func (m *ReverseScanResponse) MarshalTo(data []byte) (int, error)

func (*ReverseScanResponse) ProtoMessage

func (*ReverseScanResponse) ProtoMessage()

func (*ReverseScanResponse) Reset

func (m *ReverseScanResponse) Reset()

func (*ReverseScanResponse) Size

func (m *ReverseScanResponse) Size() (n int)

func (*ReverseScanResponse) String

func (m *ReverseScanResponse) String() string

func (*ReverseScanResponse) Unmarshal

func (m *ReverseScanResponse) Unmarshal(data []byte) error

func (*ReverseScanResponse) Verify

func (sr *ReverseScanResponse) Verify(req Request) error

Verify verifies the integrity of every value returned in the reverse scan.

type ScanRequest

type ScanRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// If 0, there is no limit on the number of retrieved entries. Must be >= 0.
	MaxResults int64 `protobuf:"varint,2,opt,name=max_results" json:"max_results"`
}

A ScanRequest is the argument to the Scan() method. It specifies the start and end keys for an ascending scan of [start,end) and the maximum number of results.

func (*ScanRequest) CreateReply

func (*ScanRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*ScanRequest) GetBound

func (sr *ScanRequest) GetBound() int64

GetBound returns the MaxResults field in ScanRequest.

func (*ScanRequest) Marshal

func (m *ScanRequest) Marshal() (data []byte, err error)

func (*ScanRequest) MarshalTo

func (m *ScanRequest) MarshalTo(data []byte) (int, error)

func (*ScanRequest) Method

func (*ScanRequest) Method() Method

Method implements the Request interface.

func (*ScanRequest) ProtoMessage

func (*ScanRequest) ProtoMessage()

func (*ScanRequest) Reset

func (m *ScanRequest) Reset()

func (*ScanRequest) SetBound

func (sr *ScanRequest) SetBound(bound int64)

SetBound sets the MaxResults field in ScanRequest.

func (*ScanRequest) Size

func (m *ScanRequest) Size() (n int)

func (*ScanRequest) String

func (m *ScanRequest) String() string

func (*ScanRequest) Unmarshal

func (m *ScanRequest) Unmarshal(data []byte) error

type ScanResponse

type ScanResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// Empty if no rows were scanned.
	Rows []KeyValue `protobuf:"bytes,2,rep,name=rows" json:"rows"`
}

A ScanResponse is the return value from the Scan() method.

func (*ScanResponse) Combine

func (sr *ScanResponse) Combine(c Response) error

Combine implements the Combinable interface.

func (*ScanResponse) Count

func (sr *ScanResponse) Count() int64

Count returns the number of rows in ScanResponse.

func (*ScanResponse) Marshal

func (m *ScanResponse) Marshal() (data []byte, err error)

func (*ScanResponse) MarshalTo

func (m *ScanResponse) MarshalTo(data []byte) (int, error)

func (*ScanResponse) ProtoMessage

func (*ScanResponse) ProtoMessage()

func (*ScanResponse) Reset

func (m *ScanResponse) Reset()

func (*ScanResponse) Size

func (m *ScanResponse) Size() (n int)

func (*ScanResponse) String

func (m *ScanResponse) String() string

func (*ScanResponse) Unmarshal

func (m *ScanResponse) Unmarshal(data []byte) error

func (*ScanResponse) Verify

func (sr *ScanResponse) Verify(req Request) error

Verify verifies the integrity of every value returned in the scan.

type SendError

type SendError struct {
	Message   string `protobuf:"bytes,1,opt,name=message" json:"message"`
	Retryable bool   `protobuf:"varint,2,opt,name=retryable" json:"retryable"`
}

A SendError indicates that a message could not be delivered to the desired recipient(s).

func (SendError) CanRetry

func (s SendError) CanRetry() bool

CanRetry implements the Retryable interface.

func (SendError) Error

func (s SendError) Error() string

Error formats error.

func (*SendError) Marshal

func (m *SendError) Marshal() (data []byte, err error)

func (*SendError) MarshalTo

func (m *SendError) MarshalTo(data []byte) (int, error)

func (*SendError) ProtoMessage

func (*SendError) ProtoMessage()

func (*SendError) Reset

func (m *SendError) Reset()

func (*SendError) Size

func (m *SendError) Size() (n int)

func (*SendError) Unmarshal

func (m *SendError) Unmarshal(data []byte) error

type SequenceCacheEntry

type SequenceCacheEntry struct {
	// The key of the associated transaction.
	Key Key `protobuf:"bytes,1,opt,name=key,casttype=Key" json:"key,omitempty"`
	// The original timestamp of the associated transaction.
	Timestamp Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp"`
}

SequenceCacheEntry holds information which together with the key at which it is stored suffices to reconstruct the location of the original transaction record along with its approximate age.

func (*SequenceCacheEntry) Marshal

func (m *SequenceCacheEntry) Marshal() (data []byte, err error)

func (*SequenceCacheEntry) MarshalTo

func (m *SequenceCacheEntry) MarshalTo(data []byte) (int, error)

func (*SequenceCacheEntry) ProtoMessage

func (*SequenceCacheEntry) ProtoMessage()

func (*SequenceCacheEntry) Reset

func (m *SequenceCacheEntry) Reset()

func (*SequenceCacheEntry) Size

func (m *SequenceCacheEntry) Size() (n int)

func (*SequenceCacheEntry) String

func (m *SequenceCacheEntry) String() string

func (*SequenceCacheEntry) Unmarshal

func (m *SequenceCacheEntry) Unmarshal(data []byte) error

type Span

type Span struct {
	// The key for request. If the request operates on a range, this
	// represents the starting key for the range.
	Key Key `protobuf:"bytes,3,opt,name=key,casttype=Key" json:"key,omitempty"`
	// The end key is empty if the request spans only a single key. Otherwise,
	// it must order strictly after Key. In such a case, the header indicates
	// that the operation takes place on the key range from Key to EndKey,
	// including Key and excluding EndKey.
	EndKey Key `protobuf:"bytes,4,opt,name=end_key,casttype=Key" json:"end_key,omitempty"`
}

Span is supplied with every storage node request.

func (*Span) Header

func (rh *Span) Header() *Span

Header implements the Request interface for RequestHeader.

func (*Span) Marshal

func (m *Span) Marshal() (data []byte, err error)

func (*Span) MarshalTo

func (m *Span) MarshalTo(data []byte) (int, error)

func (*Span) ProtoMessage

func (*Span) ProtoMessage()

func (*Span) Reset

func (m *Span) Reset()

func (*Span) Size

func (m *Span) Size() (n int)

func (*Span) String

func (m *Span) String() string

func (*Span) Unmarshal

func (m *Span) Unmarshal(data []byte) error

type SplitTrigger

type SplitTrigger struct {
	UpdatedDesc RangeDescriptor `protobuf:"bytes,1,opt,name=updated_desc" json:"updated_desc"`
	NewDesc     RangeDescriptor `protobuf:"bytes,2,opt,name=new_desc" json:"new_desc"`
}

A SplitTrigger is run after a successful commit of an AdminSplit command. It provides the updated range descriptor covering the first half of the split and the new range descriptor covering the second half. This information allows the final bookkeeping for the split to be completed and the new range put into operation.

func (*SplitTrigger) Marshal

func (m *SplitTrigger) Marshal() (data []byte, err error)

func (*SplitTrigger) MarshalTo

func (m *SplitTrigger) MarshalTo(data []byte) (int, error)

func (*SplitTrigger) ProtoMessage

func (*SplitTrigger) ProtoMessage()

func (*SplitTrigger) Reset

func (m *SplitTrigger) Reset()

func (*SplitTrigger) Size

func (m *SplitTrigger) Size() (n int)

func (*SplitTrigger) String

func (m *SplitTrigger) String() string

func (*SplitTrigger) Unmarshal

func (m *SplitTrigger) Unmarshal(data []byte) error

type StoreCapacity

type StoreCapacity struct {
	Capacity   int64 `protobuf:"varint,1,opt,name=Capacity" json:"Capacity"`
	Available  int64 `protobuf:"varint,2,opt,name=Available" json:"Available"`
	RangeCount int32 `protobuf:"varint,3,opt,name=RangeCount" json:"RangeCount"`
}

StoreCapacity contains capacity information for a storage device.

func (StoreCapacity) FractionUsed

func (sc StoreCapacity) FractionUsed() float64

FractionUsed computes the fraction of storage capacity that is in use.

func (*StoreCapacity) Marshal

func (m *StoreCapacity) Marshal() (data []byte, err error)

func (*StoreCapacity) MarshalTo

func (m *StoreCapacity) MarshalTo(data []byte) (int, error)

func (*StoreCapacity) ProtoMessage

func (*StoreCapacity) ProtoMessage()

func (*StoreCapacity) Reset

func (m *StoreCapacity) Reset()

func (*StoreCapacity) Size

func (m *StoreCapacity) Size() (n int)

func (*StoreCapacity) String

func (m *StoreCapacity) String() string

func (*StoreCapacity) Unmarshal

func (m *StoreCapacity) Unmarshal(data []byte) error

type StoreDescriptor

type StoreDescriptor struct {
	StoreID  StoreID        `protobuf:"varint,1,opt,name=store_id,casttype=StoreID" json:"store_id"`
	Attrs    Attributes     `protobuf:"bytes,2,opt,name=attrs" json:"attrs"`
	Node     NodeDescriptor `protobuf:"bytes,3,opt,name=node" json:"node"`
	Capacity StoreCapacity  `protobuf:"bytes,4,opt,name=capacity" json:"capacity"`
}

StoreDescriptor holds store information including store attributes, node descriptor and store capacity.

func (StoreDescriptor) CombinedAttrs

func (s StoreDescriptor) CombinedAttrs() *Attributes

CombinedAttrs returns the full list of attributes for the store, including both the node and store attributes.

func (*StoreDescriptor) Marshal

func (m *StoreDescriptor) Marshal() (data []byte, err error)

func (*StoreDescriptor) MarshalTo

func (m *StoreDescriptor) MarshalTo(data []byte) (int, error)

func (*StoreDescriptor) ProtoMessage

func (*StoreDescriptor) ProtoMessage()

func (*StoreDescriptor) Reset

func (m *StoreDescriptor) Reset()

func (*StoreDescriptor) Size

func (m *StoreDescriptor) Size() (n int)

func (*StoreDescriptor) String

func (m *StoreDescriptor) String() string

func (*StoreDescriptor) Unmarshal

func (m *StoreDescriptor) Unmarshal(data []byte) error

type StoreID

type StoreID int32

StoreID is a custom type for a cockroach store ID.

func (StoreID) String

func (n StoreID) String() string

String implements the fmt.Stringer interface. It is used to format the ID for use in Gossip keys.

type StoreIDSlice

type StoreIDSlice []StoreID

StoreIDSlice implements sort.Interface.

func (StoreIDSlice) Len

func (s StoreIDSlice) Len() int

func (StoreIDSlice) Less

func (s StoreIDSlice) Less(i, j int) bool

func (StoreIDSlice) Swap

func (s StoreIDSlice) Swap(i, j int)

type StoreIdent

type StoreIdent struct {
	ClusterID string  `protobuf:"bytes,1,opt,name=cluster_id" json:"cluster_id"`
	NodeID    NodeID  `protobuf:"varint,2,opt,name=node_id,casttype=NodeID" json:"node_id"`
	StoreID   StoreID `protobuf:"varint,3,opt,name=store_id,casttype=StoreID" json:"store_id"`
}

A StoreIdent uniquely identifies a store in the cluster. The StoreIdent is written to the underlying storage engine at a store-reserved system key (KeyLocalIdent).

func (*StoreIdent) Marshal

func (m *StoreIdent) Marshal() (data []byte, err error)

func (*StoreIdent) MarshalTo

func (m *StoreIdent) MarshalTo(data []byte) (int, error)

func (*StoreIdent) ProtoMessage

func (*StoreIdent) ProtoMessage()

func (*StoreIdent) Reset

func (m *StoreIdent) Reset()

func (*StoreIdent) Size

func (m *StoreIdent) Size() (n int)

func (*StoreIdent) String

func (m *StoreIdent) String() string

func (*StoreIdent) Unmarshal

func (m *StoreIdent) Unmarshal(data []byte) error

type Timestamp

type Timestamp struct {
	// Holds a wall time, typically a unix epoch time
	// expressed in nanoseconds.
	WallTime int64 `protobuf:"varint,1,opt,name=wall_time" json:"wall_time"`
	// The logical component captures causality for events whose wall
	// times are equal. It is effectively bounded by (maximum clock
	// skew)/(minimal ns between events) and nearly impossible to
	// overflow.
	Logical int32 `protobuf:"varint,2,opt,name=logical" json:"logical"`
}

Timestamp represents a state of the hybrid logical clock.

func (Timestamp) Add

func (t Timestamp) Add(wallTime int64, logical int32) Timestamp

Add returns a timestamp with the WallTime and Logical components increased.

func (*Timestamp) Backward

func (t *Timestamp) Backward(s Timestamp)

Backward updates the timestamp from the one given, if that moves it backwards in time.

func (Timestamp) Equal

func (t Timestamp) Equal(s Timestamp) bool

Equal returns whether two timestamps are the same.

func (*Timestamp) Forward

func (t *Timestamp) Forward(s Timestamp)

Forward updates the timestamp from the one given, if that moves it forwards in time.

func (Timestamp) GoTime

func (t Timestamp) GoTime() time.Time

GoTime converts the timestamp to a time.Time.

func (Timestamp) Less

func (t Timestamp) Less(s Timestamp) bool

Less compares two timestamps.

func (*Timestamp) Marshal

func (m *Timestamp) Marshal() (data []byte, err error)

func (*Timestamp) MarshalTo

func (m *Timestamp) MarshalTo(data []byte) (int, error)

func (*Timestamp) Next

func (t *Timestamp) Next() Timestamp

Next returns the timestamp with the next later timestamp.

func (*Timestamp) Prev

func (t *Timestamp) Prev() Timestamp

Prev returns the next earliest timestamp.

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (*Timestamp) Reset

func (m *Timestamp) Reset()

func (*Timestamp) Size

func (m *Timestamp) Size() (n int)

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) Unmarshal

func (m *Timestamp) Unmarshal(data []byte) error

type Transaction

type Transaction struct {
	Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
	// key is the key which anchors the transaction. This is typically
	// the first key read or written during the transaction and determines which
	// range in the cluster will hold the transaction record.
	Key Key `protobuf:"bytes,2,opt,name=key,casttype=Key" json:"key,omitempty"`
	// id is a unique UUID value which identifies the transaction.
	ID        []byte            `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"`
	Priority  int32             `protobuf:"varint,4,opt,name=priority" json:"priority"`
	Isolation IsolationType     `protobuf:"varint,5,opt,name=isolation,enum=cockroach.roachpb.IsolationType" json:"isolation"`
	Status    TransactionStatus `protobuf:"varint,6,opt,name=status,enum=cockroach.roachpb.TransactionStatus" json:"status"`
	// Incremented on txn retry.
	Epoch int32 `protobuf:"varint,7,opt,name=epoch" json:"epoch"`
	// The last heartbeat timestamp.
	LastHeartbeat *Timestamp `protobuf:"bytes,8,opt,name=last_heartbeat" json:"last_heartbeat,omitempty"`
	// The proposed timestamp for the transaction. This starts as
	// the current wall time on the txn coordinator.
	Timestamp Timestamp `protobuf:"bytes,9,opt,name=timestamp" json:"timestamp"`
	// The original timestamp at which the transaction started. For serializable
	// transactions, if the timestamp drifts from the original timestamp, the
	// transaction will retry.
	OrigTimestamp Timestamp `protobuf:"bytes,10,opt,name=orig_timestamp" json:"orig_timestamp"`
	// Initial Timestamp + clock skew. Reads which encounter values with
	// timestamps between timestamp and max_timestamp trigger a txn
	// retry error, unless the node being read is listed in certain_nodes
	// (in which case no more read uncertainty can occur).
	// The case max_timestamp < timestamp is possible for transactions which have
	// been pushed; in this case, max_timestamp should be ignored.
	MaxTimestamp Timestamp `protobuf:"bytes,11,opt,name=max_timestamp" json:"max_timestamp"`
	// A sorted list of ids of nodes for which a ReadWithinUncertaintyIntervalError
	// occurred during a prior read. The purpose of keeping this information is
	// that as a reaction to this error, the transaction's timestamp is forwarded
	// appropriately to reflect that node's clock uncertainty. Future reads to
	// the same node are therefore freed from uncertainty restarts.
	//
	// The exact mechanism is that upon encountering the above error, the trans-
	// action will have to retry with a higher timestamp. This higher timestamp
	// is either the one of the encountered future write returned in the error
	// or (if higher, which is in the majority of cases), the time of the node
	// serving the key at the time of the failed read.
	// Additionally storing the node, we make sure to set max_timestamp=timestamp
	// at the time of the read for nodes whose clock we've taken into account,
	// which amounts to reading without any uncertainty.
	//
	// Bits of this mechanism are found in the local sender, the range and the
	// txn_coord_sender, with brief comments referring here.
	// See https://github.com/cockroachdb/cockroach/pull/221.
	CertainNodes NodeList `protobuf:"bytes,12,opt,name=certain_nodes" json:"certain_nodes"`
	// Writing is true if the transaction has previously executed a successful
	// write request, i.e. a request that may have left intents (across retries).
	Writing bool `protobuf:"varint,13,opt,name=Writing" json:"Writing"`
	// A one-indexed sequence number which is increased on each batch sent as
	// part of the transaction. Used to prevent replay and out-of-order
	// application protection (by means of a transaction retry).
	Sequence uint32 `protobuf:"varint,14,opt,name=Sequence" json:"Sequence"`
	Intents  []Span `protobuf:"bytes,15,rep,name=Intents" json:"Intents"`
}

A Transaction is a unit of work performed on the database. Cockroach transactions support two isolation levels: snapshot isolation and serializable snapshot isolation. Each Cockroach transaction is assigned a random priority. This priority will be used to decide whether a transaction will be aborted during contention. TODO(vivek): Remove parts of Transaction that expose internals.

func NewTransaction

func NewTransaction(name string, baseKey Key, userPriority int32,
	isolation IsolationType, now Timestamp, maxOffset int64) *Transaction

NewTransaction creates a new transaction. The transaction key is composed using the specified baseKey (for locality with data affected by the transaction) and a random ID to guarantee uniqueness. The specified user-level priority is combined with a randomly chosen value to yield a final priority, used to settle write conflicts in a way that avoids starvation of long-running transactions (see Replica.PushTxn).

func (*Transaction) Clone

func (t *Transaction) Clone() *Transaction

Clone creates a deep copy of the given transaction.

func (*Transaction) Equal

func (t *Transaction) Equal(s *Transaction) bool

Equal tests two transactions for equality. They are equal if they are either simultaneously nil or their IDs match.

func (*Transaction) IsInitialized

func (t *Transaction) IsInitialized() bool

IsInitialized returns true if the transaction has been initialized.

func (*Transaction) Marshal

func (m *Transaction) Marshal() (data []byte, err error)

func (*Transaction) MarshalTo

func (m *Transaction) MarshalTo(data []byte) (int, error)

func (*Transaction) ProtoMessage

func (*Transaction) ProtoMessage()

func (*Transaction) Reset

func (m *Transaction) Reset()

func (*Transaction) Restart

func (t *Transaction) Restart(userPriority, upgradePriority int32, timestamp Timestamp)

Restart reconfigures a transaction for restart. The epoch is incremented for an in-place restart. The timestamp of the transaction on restart is set to the maximum of the transaction's timestamp and the specified timestamp.

func (Transaction) Short

func (t Transaction) Short() string

Short returns the short form of the Transaction's UUID.

func (*Transaction) Size

func (m *Transaction) Size() (n int)

func (Transaction) String

func (t Transaction) String() string

String formats transaction into human readable string.

func (*Transaction) TraceID

func (t *Transaction) TraceID() string

TraceID implements tracer.Traceable. For a nontrivial Transaction, it returns 't', followed by the transaction ID. Otherwise, the empty string is returned.

func (*Transaction) TraceName

func (t *Transaction) TraceName() string

TraceName implements tracer.Traceable. It returns TraceID, but using the short version of the UUID.

func (*Transaction) Unmarshal

func (m *Transaction) Unmarshal(data []byte) error

func (*Transaction) Update

func (t *Transaction) Update(o *Transaction)

Update ratchets priority, timestamp and original timestamp values (among others) for the transaction. If t.ID is empty, then the transaction is copied from o.

func (*Transaction) UpgradePriority

func (t *Transaction) UpgradePriority(minPriority int32)

UpgradePriority sets transaction priority to the maximum of current priority and the specified minPriority.

type TransactionAbortedError

type TransactionAbortedError struct {
	Txn Transaction `protobuf:"bytes,1,opt,name=txn" json:"txn"`
}

A TransactionAbortedError indicates that the transaction was aborted by another concurrent transaction.

func NewTransactionAbortedError

func NewTransactionAbortedError(txn *Transaction) *TransactionAbortedError

NewTransactionAbortedError initializes a new TransactionAbortedError. It creates a copy of the given Transaction.

func (*TransactionAbortedError) CanRestartTransaction

func (e *TransactionAbortedError) CanRestartTransaction() TransactionRestart

CanRestartTransaction implements the TransactionRestartError interface.

func (*TransactionAbortedError) Error

func (e *TransactionAbortedError) Error() string

Error formats error.

func (*TransactionAbortedError) Marshal

func (m *TransactionAbortedError) Marshal() (data []byte, err error)

func (*TransactionAbortedError) MarshalTo

func (m *TransactionAbortedError) MarshalTo(data []byte) (int, error)

func (*TransactionAbortedError) ProtoMessage

func (*TransactionAbortedError) ProtoMessage()

func (*TransactionAbortedError) Reset

func (m *TransactionAbortedError) Reset()

func (*TransactionAbortedError) Size

func (m *TransactionAbortedError) Size() (n int)

func (*TransactionAbortedError) Transaction

func (*TransactionAbortedError) Transaction() *Transaction

Transaction implements TransactionRestartError. It returns nil.

func (*TransactionAbortedError) Unmarshal

func (m *TransactionAbortedError) Unmarshal(data []byte) error

type TransactionPushError

type TransactionPushError struct {
	// txn can be null in the event the push error happened to a
	// non-transactional method.
	Txn       *Transaction `protobuf:"bytes,1,opt,name=txn" json:"txn,omitempty"`
	PusheeTxn Transaction  `protobuf:"bytes,2,opt,name=pushee_txn" json:"pushee_txn"`
}

A TransactionPushError indicates that the transaction could not continue because it encountered a write intent from another transaction which it was unable to push.

func NewTransactionPushError

func NewTransactionPushError(txn, pusheeTxn Transaction) *TransactionPushError

NewTransactionPushError initializes a new TransactionPushError. Txn is the transaction which will be retried. Both arguments are copied. Transactions.

func (*TransactionPushError) CanRestartTransaction

func (e *TransactionPushError) CanRestartTransaction() TransactionRestart

CanRestartTransaction implements the TransactionRestartError interface.

func (*TransactionPushError) Error

func (e *TransactionPushError) Error() string

Error formats error.

func (*TransactionPushError) Marshal

func (m *TransactionPushError) Marshal() (data []byte, err error)

func (*TransactionPushError) MarshalTo

func (m *TransactionPushError) MarshalTo(data []byte) (int, error)

func (*TransactionPushError) ProtoMessage

func (*TransactionPushError) ProtoMessage()

func (*TransactionPushError) Reset

func (m *TransactionPushError) Reset()

func (*TransactionPushError) Size

func (m *TransactionPushError) Size() (n int)

func (*TransactionPushError) Transaction

func (*TransactionPushError) Transaction() *Transaction

Transaction implements the TransactionRestartError interface.

func (*TransactionPushError) Unmarshal

func (m *TransactionPushError) Unmarshal(data []byte) error

type TransactionRestart

type TransactionRestart int32

TransactionRestart indicates how an error should be handled in a transactional context.

const (
	// ABORT (the default) is for errors that are considered permanent
	// and should abort the transaction.
	TransactionRestart_ABORT TransactionRestart = 0
	// BACKOFF is for errors that can retried by restarting the transaction
	// after an exponential backoff.
	TransactionRestart_BACKOFF TransactionRestart = 1
	// IMMEDIATE is for errors that can be retried by restarting the
	// transaction immediately.
	TransactionRestart_IMMEDIATE TransactionRestart = 2
)

func (TransactionRestart) Enum

func (TransactionRestart) String

func (x TransactionRestart) String() string

func (*TransactionRestart) UnmarshalJSON

func (x *TransactionRestart) UnmarshalJSON(data []byte) error

type TransactionRestartError

type TransactionRestartError interface {
	CanRestartTransaction() TransactionRestart
	// Optionally, a transaction that should be used
	// for an update before retrying.
	Transaction() *Transaction
}

TransactionRestartError is an interface implemented by errors that cause a transaction to be restarted.

type TransactionRetryError

type TransactionRetryError struct {
	Txn Transaction `protobuf:"bytes,1,opt,name=txn" json:"txn"`
}

A TransactionRetryError indicates that the transaction must be retried, usually with an increased transaction timestamp. The transaction struct to use is returned with the error.

func NewTransactionRetryError

func NewTransactionRetryError(txn *Transaction) *TransactionRetryError

NewTransactionRetryError initializes a new TransactionRetryError. Txn is the transaction which will be retried (a copy is taken).

func (*TransactionRetryError) CanRestartTransaction

func (*TransactionRetryError) CanRestartTransaction() TransactionRestart

CanRestartTransaction implements the TransactionRestartError interface.

func (*TransactionRetryError) Error

func (e *TransactionRetryError) Error() string

Error formats error.

func (*TransactionRetryError) Marshal

func (m *TransactionRetryError) Marshal() (data []byte, err error)

func (*TransactionRetryError) MarshalTo

func (m *TransactionRetryError) MarshalTo(data []byte) (int, error)

func (*TransactionRetryError) ProtoMessage

func (*TransactionRetryError) ProtoMessage()

func (*TransactionRetryError) Reset

func (m *TransactionRetryError) Reset()

func (*TransactionRetryError) Size

func (m *TransactionRetryError) Size() (n int)

func (*TransactionRetryError) Transaction

func (e *TransactionRetryError) Transaction() *Transaction

Transaction implements the TransactionRestartError interface.

func (*TransactionRetryError) Unmarshal

func (m *TransactionRetryError) Unmarshal(data []byte) error

type TransactionStatus

type TransactionStatus int32

TransactionStatus specifies possible states for a transaction.

const (
	// PENDING is the default state for a new transaction. Transactions
	// move from PENDING to one of COMMITTED or ABORTED. Mutations made
	// as part of a PENDING transactions are recorded as "intents" in
	// the underlying MVCC model.
	PENDING TransactionStatus = 0
	// COMMITTED is the state for a transaction which has been
	// committed. Mutations made as part of a transaction which is moved
	// into COMMITTED state become durable and visible to other
	// transactions, moving from "intents" to permanent versioned
	// values.
	COMMITTED TransactionStatus = 1
	// ABORTED is the state for a transaction which has been aborted.
	// Mutations made as part of a transaction which is moved into
	// ABORTED state are deleted and are never made visible to other
	// transactions.
	ABORTED TransactionStatus = 2
)

func (TransactionStatus) Enum

func (TransactionStatus) String

func (x TransactionStatus) String() string

func (*TransactionStatus) UnmarshalJSON

func (x *TransactionStatus) UnmarshalJSON(data []byte) error

type TransactionStatusError

type TransactionStatusError struct {
	Txn Transaction `protobuf:"bytes,1,opt,name=txn" json:"txn"`
	Msg string      `protobuf:"bytes,2,opt,name=msg" json:"msg"`
}

A TransactionStatusError indicates that the transaction status is incompatible with the requested operation. This might mean the transaction has already been committed. It might also be the case that the request to modify the transaction failed due to a regression in transaction epoch or timestamp, both of which may only monotonically increase.

func NewTransactionStatusError

func NewTransactionStatusError(txn Transaction, msg string) *TransactionStatusError

NewTransactionStatusError initializes a new TransactionStatusError from the given Transaction (which is copied) and a message.

func (*TransactionStatusError) Error

func (e *TransactionStatusError) Error() string

Error formats error.

func (*TransactionStatusError) Marshal

func (m *TransactionStatusError) Marshal() (data []byte, err error)

func (*TransactionStatusError) MarshalTo

func (m *TransactionStatusError) MarshalTo(data []byte) (int, error)

func (*TransactionStatusError) ProtoMessage

func (*TransactionStatusError) ProtoMessage()

func (*TransactionStatusError) Reset

func (m *TransactionStatusError) Reset()

func (*TransactionStatusError) Size

func (m *TransactionStatusError) Size() (n int)

func (*TransactionStatusError) Unmarshal

func (m *TransactionStatusError) Unmarshal(data []byte) error

type TruncateLogRequest

type TruncateLogRequest struct {
	Span `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// Log entries < this index are to be discarded.
	Index uint64 `protobuf:"varint,2,opt,name=index" json:"index"`
	// RangeID is used to double check that the correct range is being truncated.
	// The header specifies a span, start and end keys, but not the range id
	// itself. The range may have changed from the one specified in the header
	// in the case of a merge.
	RangeID RangeID `protobuf:"varint,3,opt,name=range_id,casttype=RangeID" json:"range_id"`
}

TruncateLogRequest is used to remove a prefix of the raft log. While there is no requirement for correctness that the raft log truncation be synchronized across replicas, it is nice to preserve the property that all replicas of a range are as close to identical as possible. The raft leader can also inform decisions about the cutoff point with its knowledge of the replicas' acknowledgement status.

func (*TruncateLogRequest) CreateReply

func (*TruncateLogRequest) CreateReply() Response

CreateReply implements the Request interface.

func (*TruncateLogRequest) Marshal

func (m *TruncateLogRequest) Marshal() (data []byte, err error)

func (*TruncateLogRequest) MarshalTo

func (m *TruncateLogRequest) MarshalTo(data []byte) (int, error)

func (*TruncateLogRequest) Method

func (*TruncateLogRequest) Method() Method

Method implements the Request interface.

func (*TruncateLogRequest) ProtoMessage

func (*TruncateLogRequest) ProtoMessage()

func (*TruncateLogRequest) Reset

func (m *TruncateLogRequest) Reset()

func (*TruncateLogRequest) Size

func (m *TruncateLogRequest) Size() (n int)

func (*TruncateLogRequest) String

func (m *TruncateLogRequest) String() string

func (*TruncateLogRequest) Unmarshal

func (m *TruncateLogRequest) Unmarshal(data []byte) error

type TruncateLogResponse

type TruncateLogResponse struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
}

TruncateLogResponse is the response to a TruncateLog() operation.

func (*TruncateLogResponse) Marshal

func (m *TruncateLogResponse) Marshal() (data []byte, err error)

func (*TruncateLogResponse) MarshalTo

func (m *TruncateLogResponse) MarshalTo(data []byte) (int, error)

func (*TruncateLogResponse) ProtoMessage

func (*TruncateLogResponse) ProtoMessage()

func (*TruncateLogResponse) Reset

func (m *TruncateLogResponse) Reset()

func (*TruncateLogResponse) Size

func (m *TruncateLogResponse) Size() (n int)

func (*TruncateLogResponse) String

func (m *TruncateLogResponse) String() string

func (*TruncateLogResponse) Unmarshal

func (m *TruncateLogResponse) Unmarshal(data []byte) error

type Value

type Value struct {
	// raw_bytes is the byte slice value.
	RawBytes []byte `protobuf:"bytes,1,opt,name=raw_bytes" json:"raw_bytes,omitempty"`
	// checksum is a CRC-32-IEEE checksum of the key + value, in that order.
	// If this is an integer value, then the value is interpreted as an 8
	// byte, big-endian encoded value. This value is set by the client on
	// writes to do end-to-end integrity verification. If the checksum is
	// incorrect, the write operation will fail. If the client does not
	// wish to use end-to-end checksumming, this value should be nil.
	Checksum *uint32 `protobuf:"fixed32,3,opt,name=checksum" json:"checksum,omitempty"`
	// Timestamp of value.
	Timestamp *Timestamp `protobuf:"bytes,4,opt,name=timestamp" json:"timestamp,omitempty"`
	// tag is the optional type of the value.
	Tag ValueType `protobuf:"varint,5,opt,name=tag,enum=cockroach.roachpb.ValueType" json:"tag"`
}

Value specifies the value at a key. Multiple values at the same key are supported based on timestamp.

func MakeValueFromBytes

func MakeValueFromBytes(bs []byte) Value

MakeValueFromBytes returns a value with bytes and tag set.

func MakeValueFromBytesAndTimestamp

func MakeValueFromBytesAndTimestamp(bs []byte, t Timestamp) Value

MakeValueFromBytesAndTimestamp returns a value with bytes, timestamp and tag set.

func MakeValueFromString

func MakeValueFromString(s string) Value

MakeValueFromString returns a value with bytes and tag set.

func (Value) GetBytes

func (v Value) GetBytes() ([]byte, error)

GetBytes returns the bytes field of the receiver. If the tag is not BYTES an error will be returned.

func (Value) GetFloat

func (v Value) GetFloat() (float64, error)

GetFloat decodes a float64 value from the bytes field of the receiver. If the bytes field is not 8 bytes in length or the tag is not FLOAT an error will be returned.

func (Value) GetInt

func (v Value) GetInt() (int64, error)

GetInt decodes an int64 value from the bytes field of the receiver. If the bytes field is not 8 bytes in length or the tag is not INT an error will be returned.

func (Value) GetProto

func (v Value) GetProto(msg proto.Message) error

GetProto unmarshals the bytes field of the receiver into msg. If unmarshalling fails or the tag is not BYTES, an error will be returned.

func (Value) GetTime

func (v Value) GetTime() (time.Time, error)

GetTime decodes a time value from the bytes field of the receiver. If the tag is not TIME an error will be returned.

func (Value) GetTimeseries

func (v Value) GetTimeseries() (InternalTimeSeriesData, error)

GetTimeseries decodes an InternalTimeSeriesData value from the bytes field of the receiver. An error will be returned if the tag is not TIMESERIES or if decoding fails.

func (*Value) InitChecksum

func (v *Value) InitChecksum(key []byte)

InitChecksum initializes a checksum based on the provided key and the contents of the value. If the value contains a byte slice, the checksum includes it directly.

func (*Value) Marshal

func (m *Value) Marshal() (data []byte, err error)

func (*Value) MarshalTo

func (m *Value) MarshalTo(data []byte) (int, error)

func (*Value) ProtoMessage

func (*Value) ProtoMessage()

func (*Value) Reset

func (m *Value) Reset()

func (*Value) SetBytes

func (v *Value) SetBytes(b []byte)

SetBytes sets the bytes and tag field of the receiver.

func (*Value) SetFloat

func (v *Value) SetFloat(f float64)

SetFloat encodes the specified float64 value into the bytes field of the receiver and sets the tag.

func (*Value) SetInt

func (v *Value) SetInt(i int64)

SetInt encodes the specified int64 value into the bytes field of the receiver and sets the tag.

func (*Value) SetProto

func (v *Value) SetProto(msg proto.Message) error

SetProto encodes the specified proto message into the bytes field of the receiver. If the proto message is an InternalTimeSeriesData, the tag will be set to TIMESERIES rather than BYTES.

func (*Value) SetTime

func (v *Value) SetTime(t time.Time)

SetTime encodes the specified time value into the bytes field of the receiver and sets the tag.

func (*Value) Size

func (m *Value) Size() (n int)

func (*Value) String

func (m *Value) String() string

func (*Value) Unmarshal

func (m *Value) Unmarshal(data []byte) error

func (Value) Verify

func (v Value) Verify(key []byte) error

Verify verifies the value's Checksum matches a newly-computed checksum of the value's contents. If the value's Checksum is not set the verification is a noop.

type ValueType

type ValueType int32

ValueType defines a set of type constants placed in the "tag" field of Value messages. These are defined as a protocol buffer enumeration so that they can be used portably between our Go and C code. The tags are used by the RocksDB Merge Operator to perform specialized merges.

const (
	// This is a subset of the SQL column type values, representing the
	// underlying storage for various types.
	ValueType_UNKNOWN ValueType = 0
	ValueType_INT     ValueType = 1
	ValueType_FLOAT   ValueType = 2
	ValueType_BYTES   ValueType = 3
	ValueType_TIME    ValueType = 4
	// TIMESERIES is applied to values which contain InternalTimeSeriesData.
	ValueType_TIMESERIES ValueType = 100
)

func (ValueType) Enum

func (x ValueType) Enum() *ValueType

func (ValueType) String

func (x ValueType) String() string

func (*ValueType) UnmarshalJSON

func (x *ValueType) UnmarshalJSON(data []byte) error

type WriteIntentError

type WriteIntentError struct {
	Intents  []Intent `protobuf:"bytes,1,rep,name=intents" json:"intents"`
	Resolved bool     `protobuf:"varint,2,opt,name=resolved" json:"resolved"`
	// The index, if given, contains the index of the request (in the batch)
	// whose execution caused the error.
	Index *ErrPosition `protobuf:"bytes,3,opt,name=index" json:"index,omitempty"`
}

A WriteIntentError indicates that one or more write intent belonging to another transaction were encountered leading to a read/write or write/write conflict. The keys at which the intent was encountered are set, as are the txn records for the intents' transactions. resolved is set if the intent was successfully resolved, meaning the client may retry the operation immediately. If resolved is false, the client should back off and retry.

func (*WriteIntentError) Error

func (e *WriteIntentError) Error() string

Error formats error.

func (*WriteIntentError) ErrorIndex

func (e *WriteIntentError) ErrorIndex() (int32, bool)

ErrorIndex implements IndexedError.

func (*WriteIntentError) Marshal

func (m *WriteIntentError) Marshal() (data []byte, err error)

func (*WriteIntentError) MarshalTo

func (m *WriteIntentError) MarshalTo(data []byte) (int, error)

func (*WriteIntentError) ProtoMessage

func (*WriteIntentError) ProtoMessage()

func (*WriteIntentError) Reset

func (m *WriteIntentError) Reset()

func (*WriteIntentError) SetErrorIndex

func (e *WriteIntentError) SetErrorIndex(index int32)

SetErrorIndex implements IndexedError.

func (*WriteIntentError) Size

func (m *WriteIntentError) Size() (n int)

func (*WriteIntentError) Unmarshal

func (m *WriteIntentError) Unmarshal(data []byte) error

type WriteTooOldError

type WriteTooOldError struct {
	Timestamp         Timestamp `protobuf:"bytes,1,opt,name=timestamp" json:"timestamp"`
	ExistingTimestamp Timestamp `protobuf:"bytes,2,opt,name=existing_timestamp" json:"existing_timestamp"`
}

A WriteTooOldError indicates that a write encountered a versioned value newer than its timestamp, making it impossible to rewrite history. The write should be retried at existing_timestamp+1.

func (*WriteTooOldError) Error

func (e *WriteTooOldError) Error() string

Error formats error.

func (*WriteTooOldError) Marshal

func (m *WriteTooOldError) Marshal() (data []byte, err error)

func (*WriteTooOldError) MarshalTo

func (m *WriteTooOldError) MarshalTo(data []byte) (int, error)

func (*WriteTooOldError) ProtoMessage

func (*WriteTooOldError) ProtoMessage()

func (*WriteTooOldError) Reset

func (m *WriteTooOldError) Reset()

func (*WriteTooOldError) Size

func (m *WriteTooOldError) Size() (n int)

func (*WriteTooOldError) Unmarshal

func (m *WriteTooOldError) Unmarshal(data []byte) error

Jump to

Keyboard shortcuts

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