enginepb

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package enginepb is a generated protocol buffer package.

It is generated from these files:

cockroach/pkg/storage/engine/enginepb/mvcc.proto
cockroach/pkg/storage/engine/enginepb/rocksdb.proto

It has these top-level messages:

TxnMeta
MVCCMetadata
MVCCStats
SSTUserProperties
SSTUserPropertiesCollection

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthMvcc = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMvcc   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthRocksdb = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRocksdb   = 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,
}

Functions

This section is empty.

Types

type IsolationType

type IsolationType int32

TODO(tschottdorf): Should not live in enginepb (but can't live in roachpb either).

const (
	SERIALIZABLE IsolationType = 0
	SNAPSHOT     IsolationType = 1
)

func (IsolationType) Enum

func (x IsolationType) Enum() *IsolationType

func (IsolationType) EnumDescriptor

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

func (IsolationType) String

func (x IsolationType) String() string

func (*IsolationType) UnmarshalJSON

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

type MVCCMetadata

type MVCCMetadata struct {
	Txn *TxnMeta `protobuf:"bytes,1,opt,name=txn" json:"txn,omitempty"`
	// The timestamp of the most recent versioned value if this is a
	// value that may have multiple versions. For values which may have
	// only one version, the data is stored inline (via raw_bytes), and
	// timestamp is set to zero.
	Timestamp cockroach_util_hlc.Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp"`
	// Is the most recent value a deletion tombstone?
	Deleted bool `protobuf:"varint,3,opt,name=deleted" json:"deleted"`
	// The size in bytes of the most recent encoded key.
	KeyBytes int64 `protobuf:"varint,4,opt,name=key_bytes,json=keyBytes" json:"key_bytes"`
	// The size in bytes of the most recent versioned value.
	ValBytes int64 `protobuf:"varint,5,opt,name=val_bytes,json=valBytes" json:"val_bytes"`
	// Inline value, used for non-versioned values with zero
	// timestamp. This provides an efficient short circuit of the normal
	// MVCC metadata sentinel and subsequent version rows. If timestamp
	// == (0, 0), then there is only a single MVCC metadata row with
	// value inlined, and with empty timestamp, key_bytes, and
	// val_bytes.
	RawBytes []byte `protobuf:"bytes,6,opt,name=raw_bytes,json=rawBytes" json:"raw_bytes,omitempty"`
	// This provides a measure of protection against replays caused by
	// Raft duplicating merge commands.
	MergeTimestamp *cockroach_util_hlc.Timestamp `protobuf:"bytes,7,opt,name=merge_timestamp,json=mergeTimestamp" json:"merge_timestamp,omitempty"`
}

MVCCMetadata holds MVCC metadata for a key. Used by storage/engine/mvcc.go.

func NewPopulatedMVCCMetadata

func NewPopulatedMVCCMetadata(r randyMvcc, easy bool) *MVCCMetadata

func (*MVCCMetadata) Descriptor

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

func (MVCCMetadata) IsInline

func (meta MVCCMetadata) IsInline() bool

IsInline returns true if the value is inlined in the metadata.

func (*MVCCMetadata) Marshal

func (m *MVCCMetadata) Marshal() (dAtA []byte, err error)

func (*MVCCMetadata) MarshalTo

func (m *MVCCMetadata) MarshalTo(dAtA []byte) (int, error)

func (*MVCCMetadata) ProtoMessage

func (*MVCCMetadata) ProtoMessage()

func (*MVCCMetadata) Reset

func (m *MVCCMetadata) Reset()

func (*MVCCMetadata) Size

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

func (*MVCCMetadata) String

func (m *MVCCMetadata) String() string

func (*MVCCMetadata) Unmarshal

func (m *MVCCMetadata) Unmarshal(dAtA []byte) error

type MVCCStats

type MVCCStats struct {
	// contains_estimates indicates that the MVCCStats object contains values
	// which have been estimated. This means that the stats should not be used
	// where complete accuracy is required, and instead should be recomputed
	// when necessary.
	ContainsEstimates bool `protobuf:"varint,14,opt,name=contains_estimates,json=containsEstimates" json:"contains_estimates"`
	// last_update_nanos is a timestamp at which the ages were last
	// updated. See the comment on MVCCStats.
	LastUpdateNanos int64 `protobuf:"fixed64,1,opt,name=last_update_nanos,json=lastUpdateNanos" json:"last_update_nanos"`
	// intent_age is the cumulative age of the tracked intents.
	// See the comment on MVCCStats.
	IntentAge int64 `protobuf:"fixed64,2,opt,name=intent_age,json=intentAge" json:"intent_age"`
	// gc_bytes_age is the cumulative age of the non-live data (i.e.
	// data included in key_bytes and val_bytes, but not live_bytes).
	// See the comment on MVCCStats.
	GCBytesAge int64 `protobuf:"fixed64,3,opt,name=gc_bytes_age,json=gcBytesAge" json:"gc_bytes_age"`
	// live_bytes is the number of bytes stored in keys and values which can in
	// principle be read by means of a Scan or Get in the far future, including
	// intents but not deletion tombstones (or their intents). Note that the
	// size of the meta kv pair (which could be explicit or implicit) is
	// included in this. Only the meta kv pair counts for the actual length of
	// the encoded key (regular pairs only count the timestamp suffix).
	LiveBytes int64 `protobuf:"fixed64,4,opt,name=live_bytes,json=liveBytes" json:"live_bytes"`
	// live_count is the number of meta keys tracked under live_bytes.
	LiveCount int64 `protobuf:"fixed64,5,opt,name=live_count,json=liveCount" json:"live_count"`
	// key_bytes is the number of bytes stored in all non-system
	// keys, including live, meta, old, and deleted keys.
	// Only meta keys really account for the "full" key; value
	// keys only for the timestamp suffix.
	KeyBytes int64 `protobuf:"fixed64,6,opt,name=key_bytes,json=keyBytes" json:"key_bytes"`
	// key_count is the number of meta keys tracked under key_bytes.
	KeyCount int64 `protobuf:"fixed64,7,opt,name=key_count,json=keyCount" json:"key_count"`
	// value_bytes is the number of bytes in all non-system version
	// values, including meta values.
	ValBytes int64 `protobuf:"fixed64,8,opt,name=val_bytes,json=valBytes" json:"val_bytes"`
	// val_count is the number of meta values tracked under val_bytes.
	ValCount int64 `protobuf:"fixed64,9,opt,name=val_count,json=valCount" json:"val_count"`
	// intent_bytes is the number of bytes in intent key-value
	// pairs (without their meta keys).
	IntentBytes int64 `protobuf:"fixed64,10,opt,name=intent_bytes,json=intentBytes" json:"intent_bytes"`
	// intent_count is the number of keys tracked under intent_bytes.
	// It is equal to the number of meta keys in the system with
	// a non-empty Transaction proto.
	IntentCount int64 `protobuf:"fixed64,11,opt,name=intent_count,json=intentCount" json:"intent_count"`
	// sys_bytes is the number of bytes stored in system-local kv-pairs.
	// This tracks the same quantity as (key_bytes + val_bytes), but
	// for system-local metadata keys (which aren't counted in either
	// key_bytes or val_bytes). Each of the keys falling into this group
	// is documented in keys/constants.go under the localPrefix constant
	// and is prefixed by either LocalRangeIDPrefix or LocalRangePrefix.
	SysBytes int64 `protobuf:"fixed64,12,opt,name=sys_bytes,json=sysBytes" json:"sys_bytes"`
	// sys_count is the number of meta keys tracked under sys_bytes.
	SysCount int64 `protobuf:"fixed64,13,opt,name=sys_count,json=sysCount" json:"sys_count"`
}

MVCCStats tracks byte and instance counts for various groups of keys, values, or key-value pairs; see the field comments for details.

It also tracks two cumulative ages, namely that of intents and non-live (i.e. GC-able) bytes. This computation is intrinsically linked to last_update_nanos and is easy to get wrong. Updates happen only once every full second, as measured by last_update_nanos/1e9. That is, forward updates don't change last_update_nanos until an update at a timestamp which, truncated to the second, is ahead of last_update_nanos/1e9. Then, that difference in seconds times the base quantity (excluding the currently running update) is added to the age. It gets more complicated when data is accounted for with a timestamp behind last_update_nanos. In this case, if more than a second has passed (computed via truncation above), the ages have to be adjusted to account for this late addition. This isn't hard: add the new data's base quantity times the (truncated) number of seconds behind. Important to keep in mind with those computations is that (x/1e9 - y/1e9) does not equal (x-y)/1e9 in most cases.

Note that this struct must be kept at a fixed size by using fixed-size encodings for all fields and by making all fields non-nullable. This is so that it can predict its own impact on the size of the system-local kv-pairs.

func NewPopulatedMVCCStats

func NewPopulatedMVCCStats(r randyMvcc, easy bool) *MVCCStats

func (*MVCCStats) Add

func (ms *MVCCStats) Add(oms MVCCStats)

Add adds values from oms to ms. The ages will be moved forward to the larger of the LastUpdateNano timestamps involved.

func (*MVCCStats) AgeTo

func (ms *MVCCStats) AgeTo(nowNanos int64)

AgeTo encapsulates the complexity of computing the increment in age quantities contained in MVCCStats. Two MVCCStats structs only add and subtract meaningfully if their LastUpdateNanos matches, so aging them to the max of their LastUpdateNanos is a prerequisite. If nowNanos is behind ms.LastUpdateNanos, this method is a noop.

func (MVCCStats) AvgIntentAge

func (ms MVCCStats) AvgIntentAge(nowNanos int64) float64

AvgIntentAge returns the average age of outstanding intents, based on current wall time specified via nowNanos.

func (*MVCCStats) Descriptor

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

func (*MVCCStats) Equal added in v1.1.0

func (this *MVCCStats) Equal(that interface{}) bool

func (MVCCStats) GCByteAge

func (ms MVCCStats) GCByteAge(nowNanos int64) int64

GCByteAge returns the total age of outstanding gc'able bytes, based on current wall time specified via nowNanos. nowNanos is ignored if it's a past timestamp as seen by rs.LastUpdateNanos.

func (MVCCStats) GCBytes

func (ms MVCCStats) GCBytes() int64

GCBytes is a convenience function which returns the number of gc bytes, that is the key and value bytes excluding the live bytes.

func (*MVCCStats) Marshal

func (m *MVCCStats) Marshal() (dAtA []byte, err error)

func (*MVCCStats) MarshalTo

func (m *MVCCStats) MarshalTo(dAtA []byte) (int, error)

func (*MVCCStats) ProtoMessage

func (*MVCCStats) ProtoMessage()

func (*MVCCStats) Reset

func (m *MVCCStats) Reset()

func (*MVCCStats) Size

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

func (*MVCCStats) String

func (m *MVCCStats) String() string

func (*MVCCStats) Subtract

func (ms *MVCCStats) Subtract(oms MVCCStats)

Subtract removes oms from ms. The ages will be moved forward to the larger of the LastUpdateNano timestamps involved.

func (MVCCStats) Total

func (ms MVCCStats) Total() int64

Total returns the range size as the sum of the key and value bytes. This includes all non-live keys and all versioned values.

func (*MVCCStats) Unmarshal

func (m *MVCCStats) Unmarshal(dAtA []byte) error

type SSTUserProperties

type SSTUserProperties struct {
	Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	// ts_min is the minimum mvcc timestamp present in this sstable.
	TsMin *cockroach_util_hlc.Timestamp `protobuf:"bytes,2,opt,name=ts_min,json=tsMin" json:"ts_min,omitempty"`
	// ts_max is the maximum mvcc timestamp present in this sstable.
	TsMax *cockroach_util_hlc.Timestamp `protobuf:"bytes,3,opt,name=ts_max,json=tsMax" json:"ts_max,omitempty"`
}

SSTUserProperties contains the user-added properties of a single sstable.

func (*SSTUserProperties) Descriptor

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

func (*SSTUserProperties) Marshal

func (m *SSTUserProperties) Marshal() (dAtA []byte, err error)

func (*SSTUserProperties) MarshalTo

func (m *SSTUserProperties) MarshalTo(dAtA []byte) (int, error)

func (*SSTUserProperties) ProtoMessage

func (*SSTUserProperties) ProtoMessage()

func (*SSTUserProperties) Reset

func (m *SSTUserProperties) Reset()

func (*SSTUserProperties) Size

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

func (*SSTUserProperties) String

func (m *SSTUserProperties) String() string

func (*SSTUserProperties) Unmarshal

func (m *SSTUserProperties) Unmarshal(dAtA []byte) error

type SSTUserPropertiesCollection

type SSTUserPropertiesCollection struct {
	Sst   []SSTUserProperties `protobuf:"bytes,1,rep,name=sst" json:"sst"`
	Error string              `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}

SSTUserPropertiesCollection contains the user-added properties of every sstable in a RocksDB instance.

func (*SSTUserPropertiesCollection) Descriptor

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

func (*SSTUserPropertiesCollection) Marshal

func (m *SSTUserPropertiesCollection) Marshal() (dAtA []byte, err error)

func (*SSTUserPropertiesCollection) MarshalTo

func (m *SSTUserPropertiesCollection) MarshalTo(dAtA []byte) (int, error)

func (*SSTUserPropertiesCollection) ProtoMessage

func (*SSTUserPropertiesCollection) ProtoMessage()

func (*SSTUserPropertiesCollection) Reset

func (m *SSTUserPropertiesCollection) Reset()

func (*SSTUserPropertiesCollection) Size

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

func (*SSTUserPropertiesCollection) String

func (m *SSTUserPropertiesCollection) String() string

func (*SSTUserPropertiesCollection) Unmarshal

func (m *SSTUserPropertiesCollection) Unmarshal(dAtA []byte) error

type TxnMeta

type TxnMeta struct {
	// id is a unique UUID value which identifies the transaction.
	// This field is always filled in.
	ID        github_com_cockroachdb_cockroach_pkg_util_uuid.UUID `protobuf:"bytes,1,opt,name=id,customtype=github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" json:"id"`
	Isolation IsolationType                                       `protobuf:"varint,2,opt,name=isolation,enum=cockroach.storage.engine.enginepb.IsolationType" json:"isolation"`
	// 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 []byte `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"`
	// Incremented on txn retry.
	Epoch uint32 `protobuf:"varint,4,opt,name=epoch" json:"epoch"`
	// The proposed timestamp for the transaction. This starts as
	// the current wall time on the txn coordinator.
	// This is the timestamp at which all of the transaction's writes are
	// performed: even if intents have been laid down at different timestamps,
	// the process of resolving them (e.g. when the txn commits) will bump them to
	// this timestamp. SERIALIZABLE transactions only commit when timestamp ==
	// orig_timestamp. SNAPSHOT transactions can commit even when they've
	// performed their reads (at orig_timestamp) at a different timestamp than
	// their writes (at timestamp).
	Timestamp cockroach_util_hlc.Timestamp `protobuf:"bytes,5,opt,name=timestamp" json:"timestamp"`
	Priority  int32                        `protobuf:"varint,6,opt,name=priority" json:"priority"`
	// 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 int32 `protobuf:"varint,7,opt,name=sequence" json:"sequence"`
	// A zero-indexed sequence number indicating the index of a
	// command within a batch. This disambiguate Raft replays of a batch
	// from multiple commands in a batch which modify the same key.
	BatchIndex int32 `protobuf:"varint,8,opt,name=batch_index,json=batchIndex" json:"batch_index"`
}

TxnMeta is the metadata of a Transaction record.

func NewPopulatedTxnMeta

func NewPopulatedTxnMeta(r randyMvcc, easy bool) *TxnMeta

func (*TxnMeta) Descriptor

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

func (*TxnMeta) Equal added in v1.1.0

func (this *TxnMeta) Equal(that interface{}) bool

func (*TxnMeta) Marshal

func (m *TxnMeta) Marshal() (dAtA []byte, err error)

func (*TxnMeta) MarshalTo

func (m *TxnMeta) MarshalTo(dAtA []byte) (int, error)

func (*TxnMeta) ProtoMessage

func (*TxnMeta) ProtoMessage()

func (*TxnMeta) Reset

func (m *TxnMeta) Reset()

func (TxnMeta) Short

func (t TxnMeta) Short() string

Short returns a prefix of the transaction's ID.

func (*TxnMeta) Size

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

func (*TxnMeta) String

func (m *TxnMeta) String() string

func (*TxnMeta) Unmarshal

func (m *TxnMeta) Unmarshal(dAtA []byte) error

Jump to

Keyboard shortcuts

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