feat(storage): add repo and schema protobuf messages with buf config
- commit
- c5c8a63a247e0eb175144fe50129a3720a0eb617
- author
- brice · · 2026-10-10 06:11 UTC
- parent
- c97ed57
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
5 files · +332 -1
A buf.gen.yaml +6 -0
| @@ -0,0 +1,6 @@ | |||
| 1 | + | version: v2 | |
| 2 | + | clean: true | |
| 3 | + | plugins: | |
| 4 | + | - local: [go, tool, protoc-gen-go] | |
| 5 | + | out: gen | |
| 6 | + | opt: paths=source_relative | |
| @@ -0,0 +1,6 @@ | |||||
| 1 | + | version: v2 | |||
| 2 | + | clean: true | |||
| 3 | + | plugins: | |||
| 4 | + | - local: [go, tool, protoc-gen-go] | |||
| 5 | + | out: gen | |||
| 6 | + | opt: paths=source_relative | |||
A buf.yaml +12 -0
| @@ -0,0 +1,12 @@ | |||
| 1 | + | version: v2 | |
| 2 | + | modules: | |
| 3 | + | - path: proto | |
| 4 | + | lint: | |
| 5 | + | use: | |
| 6 | + | - STANDARD | |
| 7 | + | except: | |
| 8 | + | # The storage schema is internal and unversioned (package ermite.storage). | |
| 9 | + | - PACKAGE_VERSION_SUFFIX | |
| 10 | + | breaking: | |
| 11 | + | use: | |
| 12 | + | - FILE | |
| @@ -0,0 +1,12 @@ | |||||
| 1 | + | version: v2 | |||
| 2 | + | modules: | |||
| 3 | + | - path: proto | |||
| 4 | + | lint: | |||
| 5 | + | use: | |||
| 6 | + | - STANDARD | |||
| 7 | + | except: | |||
| 8 | + | # The storage schema is internal and unversioned (package ermite.storage). | |||
| 9 | + | - PACKAGE_VERSION_SUFFIX | |||
| 10 | + | breaking: | |||
| 11 | + | use: | |||
| 12 | + | - FILE | |||
A gen/ermite/storage/repo.pb.go +279 -0 generated file: collapsed
M go.mod +1 -1
| @@ -12,6 +12,7 @@ tool ( | |||
| 12 | 12 | require ( | |
| 13 | 13 | github.com/bnema/zerowrap v1.4.1 | |
| 14 | 14 | github.com/stretchr/testify v1.12.1 | |
| 15 | + | google.golang.org/protobuf v1.36.12 | |
| 15 | 16 | ) | |
| 16 | 17 | ||
| 17 | 18 | require ( | |
| @@ -125,7 +126,6 @@ require ( | |||
| 125 | 126 | golang.org/x/tools v0.51.0 // indirect | |
| 126 | 127 | google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 // indirect | |
| 127 | 128 | google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 // indirect | |
| 128 | - | google.golang.org/protobuf v1.36.12 // indirect | |
| 129 | 129 | gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect | |
| 130 | 130 | gopkg.in/yaml.v3 v3.0.1 // indirect | |
| 131 | 131 | mvdan.cc/xurls/v2 v2.6.0 // indirect | |
| @@ -12,6 +12,7 @@ tool ( | |||||
| 12 | require ( | 12 | require ( | ||
| 13 | github.com/bnema/zerowrap v1.4.1 | 13 | github.com/bnema/zerowrap v1.4.1 | ||
| 14 | github.com/stretchr/testify v1.12.1 | 14 | github.com/stretchr/testify v1.12.1 | ||
| 15 | + | google.golang.org/protobuf v1.36.12 | |||
| 15 | ) | 16 | ) | ||
| 16 | 17 | ||||
| 17 | require ( | 18 | require ( | ||
| @@ -125,7 +126,6 @@ require ( | |||||
| 125 | golang.org/x/tools v0.51.0 // indirect | 126 | golang.org/x/tools v0.51.0 // indirect | ||
| 126 | google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 // indirect | 127 | google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 // indirect | ||
| 127 | google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 // indirect | 128 | google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 // indirect | ||
| 128 | - | google.golang.org/protobuf v1.36.12 // indirect | |||
| 129 | gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect | 129 | gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect | ||
| 130 | gopkg.in/yaml.v3 v3.0.1 // indirect | 130 | gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| 131 | mvdan.cc/xurls/v2 v2.6.0 // indirect | 131 | mvdan.cc/xurls/v2 v2.6.0 // indirect | ||
A proto/ermite/storage/repo.proto +34 -0
| @@ -0,0 +1,34 @@ | |||
| 1 | + | // SPDX-License-Identifier: AGPL-3.0-or-later | |
| 2 | + | ||
| 3 | + | // Internal, unversioned storage schema of ermite: the values kept in ermite-kv. | |
| 4 | + | ||
| 5 | + | syntax = "proto3"; | |
| 6 | + | ||
| 7 | + | package ermite.storage; | |
| 8 | + | ||
| 9 | + | import "google/protobuf/timestamp.proto"; | |
| 10 | + | ||
| 11 | + | option go_package = "bnema.dev/ermite/gen/ermite/storage;storagepb"; | |
| 12 | + | ||
| 13 | + | // Visibility is the access level of a repository. | |
| 14 | + | enum Visibility { | |
| 15 | + | // Unset. Readers treat it as private. | |
| 16 | + | VISIBILITY_UNSPECIFIED = 0; | |
| 17 | + | VISIBILITY_PRIVATE = 1; | |
| 18 | + | VISIBILITY_PUBLIC = 2; | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | // Repo is stored under the key "repo/<name>". | |
| 22 | + | message Repo { | |
| 23 | + | string name = 1; | |
| 24 | + | string description = 2; | |
| 25 | + | Visibility visibility = 3; | |
| 26 | + | google.protobuf.Timestamp created_at = 4; | |
| 27 | + | // Unset until the first push. | |
| 28 | + | google.protobuf.Timestamp pushed_at = 5; | |
| 29 | + | } | |
| 30 | + | ||
| 31 | + | // SchemaVersion is stored under the key "meta/schema". | |
| 32 | + | message SchemaVersion { | |
| 33 | + | uint32 version = 1; | |
| 34 | + | } | |
| @@ -0,0 +1,34 @@ | |||||
| 1 | + | // SPDX-License-Identifier: AGPL-3.0-or-later | |||
| 2 | + | ||||
| 3 | + | // Internal, unversioned storage schema of ermite: the values kept in ermite-kv. | |||
| 4 | + | ||||
| 5 | + | syntax = "proto3"; | |||
| 6 | + | ||||
| 7 | + | package ermite.storage; | |||
| 8 | + | ||||
| 9 | + | import "google/protobuf/timestamp.proto"; | |||
| 10 | + | ||||
| 11 | + | option go_package = "bnema.dev/ermite/gen/ermite/storage;storagepb"; | |||
| 12 | + | ||||
| 13 | + | // Visibility is the access level of a repository. | |||
| 14 | + | enum Visibility { | |||
| 15 | + | // Unset. Readers treat it as private. | |||
| 16 | + | VISIBILITY_UNSPECIFIED = 0; | |||
| 17 | + | VISIBILITY_PRIVATE = 1; | |||
| 18 | + | VISIBILITY_PUBLIC = 2; | |||
| 19 | + | } | |||
| 20 | + | ||||
| 21 | + | // Repo is stored under the key "repo/<name>". | |||
| 22 | + | message Repo { | |||
| 23 | + | string name = 1; | |||
| 24 | + | string description = 2; | |||
| 25 | + | Visibility visibility = 3; | |||
| 26 | + | google.protobuf.Timestamp created_at = 4; | |||
| 27 | + | // Unset until the first push. | |||
| 28 | + | google.protobuf.Timestamp pushed_at = 5; | |||
| 29 | + | } | |||
| 30 | + | ||||
| 31 | + | // SchemaVersion is stored under the key "meta/schema". | |||
| 32 | + | message SchemaVersion { | |||
| 33 | + | uint32 version = 1; | |||
| 34 | + | } | |||