Skip to content

Commit d9295a0

Browse files
committed
api: basic storage interfaces
* write default interfaces for storage/tx/... Closes #TNTP-4537.
1 parent e6c1c2d commit d9295a0

File tree

19 files changed

+659
-1
lines changed

19 files changed

+659
-1
lines changed

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ linters:
1717
- wsl # WSL is disabled, since it's obsolete. Using WSL_v5.
1818
- nlreturn # nlreturn is disabled, since it's duplicated by wsl_v5.return check.
1919
- ireturn # ireturn is disabled, since it's not needed.
20+
- godox # godox is disabled to allow TODO comments for unimplemented functionality.
2021

2122
exclusions:
2223
generated: lax
@@ -45,9 +46,13 @@ linters:
4546
- "!$test"
4647
allow:
4748
- $gostd
49+
- "github.com/tarantool/go-storage"
50+
- "go.etcd.io/etcd/client/v3"
51+
- "github.com/tarantool/go-tarantool/v2"
4852
test:
4953
files:
5054
- "$test"
5155
allow:
5256
- $gostd
57+
- "github.com/tarantool/go-storage"
5358
- "github.com/stretchr/testify"

driver/driver.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Package driver defines the interface for storage driver implementations.
2+
// It provides a common interface for different storage backends like etcd and TCS.
3+
package driver
4+
5+
import (
6+
"context"
7+
8+
"github.com/tarantool/go-storage/operation"
9+
"github.com/tarantool/go-storage/predicate"
10+
"github.com/tarantool/go-storage/tx"
11+
"github.com/tarantool/go-storage/watch"
12+
)
13+
14+
// Driver is the interface that storage drivers must implement.
15+
// It provides low-level operations for transaction execution and watch functionality.
16+
type Driver interface {
17+
// Execute executes a transactional operation with conditional logic.
18+
// The transaction will execute thenOps if all predicates evaluate to true,
19+
// otherwise it will execute elseOps.
20+
Execute(
21+
ctx context.Context,
22+
predicates []predicate.Predicate,
23+
thenOps []operation.Operation,
24+
elseOps []operation.Operation,
25+
) (tx.Response, error)
26+
27+
// Watch establishes a watch stream for changes to a specific key or prefix.
28+
// The returned channel will receive events as changes occur.
29+
Watch(ctx context.Context, key []byte, opts ...watch.Option) <-chan watch.Event
30+
}

driver/etcd/etcd.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Package etcd provides an etcd implementation of the storage driver interface.
2+
// It enables using etcd as a distributed key-value storage backend.
3+
package etcd
4+
5+
import (
6+
"context"
7+
"fmt"
8+
9+
etcd "go.etcd.io/etcd/client/v3"
10+
11+
"github.com/tarantool/go-storage/driver"
12+
"github.com/tarantool/go-storage/operation"
13+
"github.com/tarantool/go-storage/predicate"
14+
"github.com/tarantool/go-storage/tx"
15+
"github.com/tarantool/go-storage/watch"
16+
)
17+
18+
// Driver is an etcd implementation of the storage driver interface.
19+
// It uses etcd as the underlying key-value storage backend.
20+
type Driver struct {
21+
client *etcd.Client // etcd client instance..
22+
}
23+
24+
var (
25+
_ driver.Driver = &Driver{} //nolint:exhaustruct
26+
)
27+
28+
// New creates a new etcd driver instance.
29+
// It establishes a connection to the etcd cluster using the provided endpoints.
30+
func New(ctx context.Context, endpoints []string) (*Driver, error) {
31+
client, err := etcd.New(etcd.Config{
32+
Context: ctx,
33+
Endpoints: endpoints,
34+
AutoSyncInterval: 0,
35+
DialTimeout: 0,
36+
DialKeepAliveTime: 0,
37+
DialKeepAliveTimeout: 0,
38+
MaxCallSendMsgSize: 0,
39+
MaxCallRecvMsgSize: 0,
40+
TLS: nil,
41+
Username: "",
42+
Password: "",
43+
RejectOldCluster: false,
44+
DialOptions: nil,
45+
Logger: nil,
46+
LogConfig: nil,
47+
PermitWithoutStream: false,
48+
MaxUnaryRetries: 0,
49+
BackoffWaitBetween: 0,
50+
BackoffJitterFraction: 0,
51+
})
52+
if err != nil {
53+
return nil, fmt.Errorf("failed to create etcd client: %w", err)
54+
}
55+
56+
return &Driver{client: client}, nil
57+
}
58+
59+
// Execute executes a transactional operation with conditional logic.
60+
// It processes predicates to determine whether to execute thenOps or elseOps.
61+
func (d Driver) Execute(
62+
_ context.Context,
63+
_ []predicate.Predicate,
64+
_ []operation.Operation,
65+
_ []operation.Operation,
66+
) (tx.Response, error) {
67+
panic("implement me")
68+
}
69+
70+
// Watch monitors changes to a specific key and returns a stream of events.
71+
// It supports optional watch configuration through the opts parameter.
72+
func (d Driver) Watch(_ context.Context, _ []byte, _ ...watch.Option) <-chan watch.Event {
73+
panic("implement me")
74+
}

driver/tcs/tcs.go

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Package tcs provides a Tarantool Cartridge storage driver implementation.
2+
// It enables using Tarantool as a distributed key-value storage backend.
3+
package tcs
4+
5+
import (
6+
"context"
7+
"fmt"
8+
9+
"github.com/tarantool/go-tarantool/v2"
10+
"github.com/tarantool/go-tarantool/v2/pool"
11+
12+
"github.com/tarantool/go-storage/driver"
13+
"github.com/tarantool/go-storage/operation"
14+
"github.com/tarantool/go-storage/predicate"
15+
"github.com/tarantool/go-storage/tx"
16+
"github.com/tarantool/go-storage/watch"
17+
)
18+
19+
// Driver is a Tarantool implementation of the storage driver interface.
20+
// It uses TCS as the underlying key-value storage backend.
21+
type Driver struct {
22+
conn *pool.ConnectionPool // Tarantool connection pool.
23+
}
24+
25+
var (
26+
_ driver.Driver = &Driver{} //nolint:exhaustruct
27+
)
28+
29+
// New creates a new Tarantool driver instance.
30+
// It establishes connections to Tarantool instances using the provided addresses.
31+
func New(ctx context.Context, addrs []string) (*Driver, error) {
32+
instances := make([]pool.Instance, 0, len(addrs))
33+
for i, addr := range addrs {
34+
instances = append(instances, pool.Instance{
35+
Name: fmt.Sprintf("instance-%d", i),
36+
Dialer: &tarantool.NetDialer{
37+
Address: addr,
38+
User: "user",
39+
Password: "password",
40+
RequiredProtocolInfo: tarantool.ProtocolInfo{
41+
Auth: tarantool.AutoAuth,
42+
Version: tarantool.ProtocolVersion(0),
43+
Features: nil,
44+
},
45+
},
46+
Opts: tarantool.Opts{
47+
Timeout: 0,
48+
Reconnect: 0,
49+
MaxReconnects: 0,
50+
RateLimit: 0,
51+
RLimitAction: tarantool.RLimitAction(0),
52+
Concurrency: 0,
53+
SkipSchema: false,
54+
Notify: nil,
55+
Handle: nil,
56+
Logger: nil,
57+
},
58+
})
59+
}
60+
61+
conn, err := pool.Connect(ctx, instances)
62+
if err != nil {
63+
return nil, fmt.Errorf("failed to connect to tarantool pool: %w", err)
64+
}
65+
66+
return &Driver{conn: conn}, nil
67+
}
68+
69+
// Execute executes a transactional operation with conditional logic.
70+
// It processes predicates to determine whether to execute thenOps or elseOps.
71+
func (d Driver) Execute(
72+
_ context.Context,
73+
_ []predicate.Predicate,
74+
_ []operation.Operation,
75+
_ []operation.Operation,
76+
) (tx.Response, error) {
77+
panic("implement me")
78+
}
79+
80+
// Watch monitors changes to a specific key and returns a stream of events.
81+
// It supports optional watch configuration through the opts parameter.
82+
func (d Driver) Watch(_ context.Context, _ []byte, _ ...watch.Option) <-chan watch.Event {
83+
panic("implement me")
84+
}

go.mod

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
module github.com/tarantool/go-storage
22

3-
go 1.24
3+
go 1.24.0
4+
5+
require (
6+
github.com/tarantool/go-tarantool/v2 v2.4.0
7+
go.etcd.io/etcd/client/v3 v3.6.4
8+
)
9+
10+
require (
11+
github.com/coreos/go-semver v0.3.1 // indirect
12+
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
13+
github.com/gogo/protobuf v1.3.2 // indirect
14+
github.com/golang/protobuf v1.5.4 // indirect
15+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
16+
github.com/tarantool/go-iproto v1.1.0 // indirect
17+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
18+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
19+
go.etcd.io/etcd/api/v3 v3.6.4 // indirect
20+
go.etcd.io/etcd/client/pkg/v3 v3.6.4 // indirect
21+
go.uber.org/multierr v1.11.0 // indirect
22+
go.uber.org/zap v1.27.0 // indirect
23+
golang.org/x/net v0.44.0 // indirect
24+
golang.org/x/sys v0.36.0 // indirect
25+
golang.org/x/text v0.29.0 // indirect
26+
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect
27+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect
28+
google.golang.org/grpc v1.75.1 // indirect
29+
google.golang.org/protobuf v1.36.9 // indirect
30+
)

go.sum

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
2+
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
3+
github.com/coreos/go-systemd/v22 v22.6.0 h1:aGVa/v8B7hpb0TKl0MWoAavPDmHvobFe5R5zn0bCJWo=
4+
github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU=
5+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
6+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7+
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
8+
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
9+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
10+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
11+
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
12+
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
13+
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
14+
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
15+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
16+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
17+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
18+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
19+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU=
20+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
21+
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
22+
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
23+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
24+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
25+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
26+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
27+
github.com/tarantool/go-iproto v1.1.0 h1:HULVOIHsiehI+FnHfM7wMDntuzUddO09DKqu2WnFQ5A=
28+
github.com/tarantool/go-iproto v1.1.0/go.mod h1:LNCtdyZxojUed8SbOiYHoc3v9NvaZTB7p96hUySMlIo=
29+
github.com/tarantool/go-tarantool/v2 v2.4.0 h1:cfGngxdknpVVbd/vF2LvaoWsKjsLV9i3xC859XgsJlI=
30+
github.com/tarantool/go-tarantool/v2 v2.4.0/go.mod h1:MTbhdjFc3Jl63Lgi/UJr5D+QbT+QegqOzsNJGmaw7VM=
31+
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
32+
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
33+
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
34+
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
35+
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
36+
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
37+
go.etcd.io/etcd/api/v3 v3.6.4 h1:7F6N7toCKcV72QmoUKa23yYLiiljMrT4xCeBL9BmXdo=
38+
go.etcd.io/etcd/api/v3 v3.6.4/go.mod h1:eFhhvfR8Px1P6SEuLT600v+vrhdDTdcfMzmnxVXXSbk=
39+
go.etcd.io/etcd/client/pkg/v3 v3.6.4 h1:9HBYrjppeOfFjBjaMTRxT3R7xT0GLK8EJMVC4xg6ok0=
40+
go.etcd.io/etcd/client/pkg/v3 v3.6.4/go.mod h1:sbdzr2cl3HzVmxNw//PH7aLGVtY4QySjQFuaCgcRFAI=
41+
go.etcd.io/etcd/client/v3 v3.6.4 h1:YOMrCfMhRzY8NgtzUsHl8hC2EBSnuqbR3dh84Uryl7A=
42+
go.etcd.io/etcd/client/v3 v3.6.4/go.mod h1:jaNNHCyg2FdALyKWnd7hxZXZxZANb0+KGY+YQaEMISo=
43+
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
44+
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
45+
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
46+
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
47+
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
48+
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
49+
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
50+
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
51+
go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc=
52+
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
53+
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
54+
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
55+
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
56+
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
57+
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
58+
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
59+
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
60+
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
61+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
62+
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
63+
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
64+
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
65+
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
66+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
67+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
68+
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
69+
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
70+
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
71+
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
72+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
73+
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
74+
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
75+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
76+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
77+
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
78+
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
79+
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
80+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
81+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
82+
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
83+
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
84+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
85+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
86+
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
87+
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
88+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
89+
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
90+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
91+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
92+
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
93+
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
94+
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ=
95+
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw=
96+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w=
97+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og=
98+
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
99+
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
100+
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
101+
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
102+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
103+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
104+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

kv/kv.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Package kv provides key-value data structures and interfaces for storage operations.
2+
// It defines the core KeyValue type used throughout the storage system.
3+
package kv
4+
5+
// KeyValue represents a key-value pair with revision metadata.
6+
// This structure is used to store and retrieve data from the key-value storage.
7+
type KeyValue struct {
8+
// Key is the serialized representation of the key.
9+
Key []byte
10+
// Value is the serialized representation of the value.
11+
Value []byte
12+
13+
// CreateRevision is the revision number when this key was created.
14+
CreateRevision int64
15+
// ModRevision is the revision number of the last modification to this key.
16+
ModRevision int64
17+
// Version is the version counter for key modifications.
18+
Version int64
19+
}

operation/operation.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Package operation provides types and interfaces for storage operations.
2+
// It defines operation types and configurations used in transactional contexts.
3+
package operation
4+
5+
// Operation represents a storage operation to be executed.
6+
// This is used within transactions and other operation contexts.
7+
type Operation struct {
8+
// Type specifies the operation type (Get, Put, Delete).
9+
Type Type
10+
// Key is the target key for the operation.
11+
Key []byte
12+
// Value contains the data for put operations, nil for get/delete.
13+
Value []byte
14+
// Options contains additional operation configuration.
15+
Options []Option
16+
}

operation/option.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package operation
2+
3+
// Option contains configuration options for operations.
4+
type Option struct{}

0 commit comments

Comments
 (0)