Skip to content

Commit 05dfe0e

Browse files
authored
Merge pull request #8 from mjschwenne/grackle
Grackle adoptation for gokv tutorial
2 parents a766a71 + 8b270bf commit 05dfe0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1068
-51
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/commit-emails.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# commit-emails.xyz config
2+

.github/workflows/ci.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- grackle
8+
pull_request:
9+
10+
jobs:
11+
update-grackle:
12+
strategy:
13+
fail-fast: false
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: true
20+
- name: Install protoc
21+
run: sudo apt-get install protobuf-compiler -y
22+
- name: Install Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: "1.22"
26+
- name: Install Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
- name: Check Grackle
31+
run: |
32+
./update-grackle.py
33+
git diff --exit-code

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
kvdur
22
kvdur_log
33
*.prof
4+
.direnv

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ check:
77
go test ./...
88

99
fix:
10+
./update-grackle.py
1011
gofmt -w -s .

cachekv/cachekv.proto

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
syntax = "proto3";
2+
3+
message cacheValue {
4+
string v = 1;
5+
uint64 l = 2;
6+
}

fencing/ctr/ctr.proto

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
syntax = "proto3";
2+
3+
enum Error {
4+
ENone = 0;
5+
Estale = 1;
6+
}
7+
8+
message putArgs {
9+
uint64 epoch = 1;
10+
uint64 v = 2;
11+
}
12+
13+
message getArgs {
14+
uint64 epoch = 1;
15+
}
16+
17+
message getReply {
18+
Error err = 1;
19+
uint64 val = 2;
20+
}

flake.lock

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
description = "A Flake for Applying Grackle to gokv";
3+
4+
inputs = {
5+
nixpkgs.url = "nixpkgs";
6+
};
7+
8+
outputs = {nixpkgs, ...}: let
9+
system = "x86_64-linux";
10+
in {
11+
devShells."${system}".default = let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
};
15+
goose = pkgs.buildGoModule {
16+
name = "goose";
17+
src = pkgs.fetchFromGitHub {
18+
owner = "goose-lang";
19+
repo = "goose";
20+
rev = "a4f2f84193d34f56dd84fc623adc43a6441da1eb";
21+
sha256 = "1b1dfa1qsv2h7hy5x20zhic2npr5gz1zp76m1lab4v490adxj2rx";
22+
};
23+
vendorHash = "sha256-HCJ8v3TSv4UrkOsRuENWVz5Z7zQ1UsOygx0Mo7MELzY=";
24+
};
25+
grackle = pkgs.buildGoModule {
26+
name = "grackle";
27+
src = pkgs.fetchFromGitHub {
28+
owner = "mjschwenne";
29+
repo = "grackle";
30+
rev = "101412356cdfbcad78f8aaa724101312928c4978";
31+
sha256 = "06zf2bvrbbjhgrd6994h3wcaml7m83m6f9r61pj7y09xq9nw10br";
32+
};
33+
vendorHash = "sha256-Wk2v0HSAkrzxHJvCfbw6xOn0OQ1xukvYjDxk3c2LmH8=";
34+
checkPhase = false;
35+
};
36+
in
37+
pkgs.mkShell {
38+
# create an environment with the required coq libraries
39+
packages = with pkgs; [
40+
# Go deps
41+
go
42+
gopls
43+
goose
44+
grackle
45+
46+
# Protobuf deps
47+
protobuf
48+
protoc-gen-go
49+
proto-contrib
50+
protoscope
51+
52+
# nix tools
53+
nix-prefetch-git
54+
nix-prefetch
55+
update-nix-fetchgit
56+
];
57+
58+
shellHook = ''
59+
'';
60+
};
61+
};
62+
}

map_marshal/map.proto

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
syntax = "proto3";
2+
3+
message u64ToU64 {
4+
uint64 k = 1;
5+
uint64 v = 2;
6+
}
7+
8+
message mapU64ToU64 {
9+
repeated u64ToU64 entries = 1;
10+
}
11+
12+
message u64ToBytes {
13+
uint64 k = 1;
14+
bytes v = 2;
15+
}
16+
17+
message mapU64ToBytes {
18+
repeated u64ToBytes entries = 1;
19+
}

map_string_marshal/map_string.proto

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax = "proto3";
2+
3+
message u64ToString {
4+
uint64 k = 1;
5+
string v = 2;
6+
}
7+
8+
message mapU64ToString {
9+
repeated u64ToString entries = 1;
10+
}

memkv/memkv.proto

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
syntax = "proto3";
2+
3+
import "../map_marshal/map.proto";
4+
5+
enum Error {
6+
ENone = 0;
7+
EDontHaveShard = 1;
8+
}
9+
10+
enum KvOp {
11+
KV_FreshCID = 0;
12+
KV_Put = 1;
13+
KV_Get = 2;
14+
KV_Conditional_Put = 3;
15+
KV_Ins_Shard = 4;
16+
KV_Mov_Shard = 5;
17+
}
18+
19+
message putRequest {
20+
uint64 key = 1;
21+
bytes value = 2;
22+
}
23+
24+
message putReply {
25+
Error err = 1;
26+
}
27+
28+
message getRequest {
29+
uint64 key = 1;
30+
}
31+
32+
message getReply {
33+
Error err = 1;
34+
bytes value = 2;
35+
}
36+
37+
message conditionalPutRequest {
38+
uint64 key = 1;
39+
bytes expectedValue = 2;
40+
bytes newValue = 3;
41+
}
42+
43+
message conditionalPutReply {
44+
Error err = 1;
45+
bool success = 2;
46+
}
47+
48+
message installShardRequest {
49+
uint64 sid = 1;
50+
// This might be tricky since now the proto files aren't standalone
51+
mapU64ToBytes kvs = 2;
52+
}
53+
54+
message moveShardRequest {
55+
uint64 sid = 1;
56+
// De-alias HostName to uint64
57+
uint64 hostName = 2;
58+
}
59+
60+
message shardMap {
61+
repeated uint64 shards = 1;
62+
}

paxi/comulti/comulti.proto

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
syntax = "proto3";
2+
3+
message prepareReply {
4+
bool success = 1;
5+
// De-alias Entry to uint64
6+
repeated uint64 log = 2;
7+
uint64 pn = 3;
8+
}
9+
10+
message proposeArgs {
11+
uint64 pn = 1;
12+
uint64 commiteIndex = 2;
13+
// De-alias Entry to uint64
14+
repeated uint64 log = 3;
15+
}

paxi/reconf/reconf.proto

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
syntax = "proto3";
2+
3+
message config {
4+
// De-alias grove_ffi.Address to uint64
5+
repeated uint64 memebers = 1;
6+
// De-alias grove_ffi.Address to uint64
7+
repeated uint64 nextMembers = 2;
8+
}
9+
10+
message monotonicValue {
11+
uint64 version = 1;
12+
bytes val = 2;
13+
config conf = 3;
14+
}
15+
16+
message prepareReply {
17+
// Maybe should be enum?
18+
uint64 err = 1;
19+
uint64 term = 2;
20+
monotonicValue val = 3;
21+
}
22+
23+
message proposeArgs {
24+
uint64 term = 1;
25+
monotonicValue val = 2;
26+
}
27+
28+
message tryCommitReply {
29+
uint64 err = 1;
30+
uint64 version = 2;
31+
}

pyproject.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[project]
2+
name = "gokv"
3+
version = "2024.0.0"
4+
dependencies = [
5+
"ruff==0.8.1",
6+
]

reconfig/replica/replica.proto

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
syntax = "proto3";
2+
3+
message appendArgs {
4+
uint64 epoch = 1;
5+
// De-aliasing LogEntry to []byte
6+
bytes entry = 2;
7+
uint64 index = 3;
8+
}
9+
10+
message configuration {
11+
// De-aliasing grove_ffi.Address to uint64
12+
repeated uint64 replicas = 1;
13+
}
14+
15+
message becomeReplicaArgs {
16+
uint64 epoch = 1;
17+
uint64 startIndex = 2;
18+
// De-aliasing LogEntry to []byte
19+
repeated bytes log = 3;
20+
}
21+
22+
message becomePrimaryArgs {
23+
uint64 epoch = 1;
24+
configuration conf = 2;
25+
}
26+
27+
message getLogReply {
28+
// De-aliasing Error to uint64. Should this be an enum?
29+
uint64 err = 1;
30+
// De-aliasing LogEntry to []byte
31+
repeated bytes log = 2;
32+
uint64 startIndex = 3;
33+
}

reconfig/util/membership.proto

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
syntax = "proto3";
2+
3+
message configuration {
4+
// De-alias grove_ffi.Address to uint64
5+
repeated uint64 addrs = 1;
6+
}

0 commit comments

Comments
 (0)