mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 13:18:58 +00:00
refactor(api): replace map[string]uint64 with api.StoreVersion for store version handling
This commit is contained in:
1 parent
e4455e936a
commit
e50c5fbe57
8 files changed
+37
-22
No files matched your search
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/psviderski/uncloud/api/pb"
|
||||
"github.com/psviderski/uncloud/internal/corrosion"
|
||||
"github.com/psviderski/uncloud/pkg/api"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
)
|
||||
|
||||
@@ -81,14 +82,14 @@ func (s *Store) Delete(ctx context.Context, key string) error {
|
||||
// limitations documented there.
|
||||
//
|
||||
// Capturing a vector does not wait for replication or prevent further writes.
|
||||
func (s *Store) Version(ctx context.Context) (map[string]uint64, error) {
|
||||
func (s *Store) Version(ctx context.Context) (api.StoreVersion, error) {
|
||||
rows, err := s.corro.QueryContext(ctx, "SELECT site_id, db_version FROM crsql_db_versions")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("query crsql_db_versions: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
versions := make(map[string]uint64)
|
||||
versions := make(api.StoreVersion)
|
||||
for rows.Next() {
|
||||
var (
|
||||
siteID []byte
|
||||
|
||||
Reference in new issue
Block a user