blob: 6f07a1c8897f7fdcc1b2b7d9da1ba364970e1e7a [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package watchable
// GetOp represents a store get operation.
type GetOp struct {
Key []byte
}
// ScanOp represents a store scan operation.
type ScanOp struct {
Start []byte
Limit []byte
}
// PutOp represents a store put operation. The new version is written instead
// of the value to avoid duplicating the user data in the store. The version
// is used to access the user data of that specific mutation.
type PutOp struct {
Key []byte
Version []byte
}
// DeleteOp represents a store delete operation.
type DeleteOp struct {
Key []byte
}
// SyncGroupOp represents a change in SyncGroup tracking, adding or removing
// key prefixes to sync. SyncGroup prefixes cannot be changed, this is used
// to track changes due to SyncGroup create/join/leave/destroy.
type SyncGroupOp struct {
Prefixes []string
Remove bool
}
// Op represents a store operation.
type Op union {
Get GetOp
Scan ScanOp
Put PutOp
Delete DeleteOp
SyncGroup SyncGroupOp
}
// LogEntry represents a single store operation. This operation may have been
// part of a transaction, as signified by the Continued boolean. Read-only
// operations (and read-only transactions) are not logged.
type LogEntry struct {
// The store operation that was performed.
Op Op
// Time when the operation was committed.
CommitTimestamp int64
// If true, this entry is followed by more entries that belong to the same
// commit as this entry.
Continued bool
}