Skip to content

Commit

Permalink
Merge pull request #8 from mjschwenne/grackle
Browse files Browse the repository at this point in the history
Grackle adoptation for gokv tutorial
  • Loading branch information
upamanyus authored Jan 13, 2025
2 parents a766a71 + 8b270bf commit 05dfe0e
Show file tree
Hide file tree
Showing 45 changed files with 1,068 additions and 51 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .github/commit-emails.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# commit-emails.xyz config
to = "chajed@wisc.edu,schwennesen@cs.wisc.edu"
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches:
- main
- grackle
pull_request:

jobs:
update-grackle:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install protoc
run: sudo apt-get install protobuf-compiler -y
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check Grackle
run: |
./update-grackle.py
git diff --exit-code
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
kvdur
kvdur_log
*.prof
.direnv
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ check:
go test ./...

fix:
./update-grackle.py
gofmt -w -s .
6 changes: 6 additions & 0 deletions cachekv/cachekv.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
syntax = "proto3";

message cacheValue {
string v = 1;
uint64 l = 2;
}
20 changes: 20 additions & 0 deletions fencing/ctr/ctr.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

enum Error {
ENone = 0;
Estale = 1;
}

message putArgs {
uint64 epoch = 1;
uint64 v = 2;
}

message getArgs {
uint64 epoch = 1;
}

message getReply {
Error err = 1;
uint64 val = 2;
}
24 changes: 24 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
description = "A Flake for Applying Grackle to gokv";

inputs = {
nixpkgs.url = "nixpkgs";
};

outputs = {nixpkgs, ...}: let
system = "x86_64-linux";
in {
devShells."${system}".default = let
pkgs = import nixpkgs {
inherit system;
};
goose = pkgs.buildGoModule {
name = "goose";
src = pkgs.fetchFromGitHub {
owner = "goose-lang";
repo = "goose";
rev = "a4f2f84193d34f56dd84fc623adc43a6441da1eb";
sha256 = "1b1dfa1qsv2h7hy5x20zhic2npr5gz1zp76m1lab4v490adxj2rx";
};
vendorHash = "sha256-HCJ8v3TSv4UrkOsRuENWVz5Z7zQ1UsOygx0Mo7MELzY=";
};
grackle = pkgs.buildGoModule {
name = "grackle";
src = pkgs.fetchFromGitHub {
owner = "mjschwenne";
repo = "grackle";
rev = "101412356cdfbcad78f8aaa724101312928c4978";
sha256 = "06zf2bvrbbjhgrd6994h3wcaml7m83m6f9r61pj7y09xq9nw10br";
};
vendorHash = "sha256-Wk2v0HSAkrzxHJvCfbw6xOn0OQ1xukvYjDxk3c2LmH8=";
checkPhase = false;
};
in
pkgs.mkShell {
# create an environment with the required coq libraries
packages = with pkgs; [
# Go deps
go
gopls
goose
grackle

# Protobuf deps
protobuf
protoc-gen-go
proto-contrib
protoscope

# nix tools
nix-prefetch-git
nix-prefetch
update-nix-fetchgit
];

shellHook = ''
'';
};
};
}
19 changes: 19 additions & 0 deletions map_marshal/map.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";

message u64ToU64 {
uint64 k = 1;
uint64 v = 2;
}

message mapU64ToU64 {
repeated u64ToU64 entries = 1;
}

message u64ToBytes {
uint64 k = 1;
bytes v = 2;
}

message mapU64ToBytes {
repeated u64ToBytes entries = 1;
}
10 changes: 10 additions & 0 deletions map_string_marshal/map_string.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

message u64ToString {
uint64 k = 1;
string v = 2;
}

message mapU64ToString {
repeated u64ToString entries = 1;
}
62 changes: 62 additions & 0 deletions memkv/memkv.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
syntax = "proto3";

import "../map_marshal/map.proto";

enum Error {
ENone = 0;
EDontHaveShard = 1;
}

enum KvOp {
KV_FreshCID = 0;
KV_Put = 1;
KV_Get = 2;
KV_Conditional_Put = 3;
KV_Ins_Shard = 4;
KV_Mov_Shard = 5;
}

message putRequest {
uint64 key = 1;
bytes value = 2;
}

message putReply {
Error err = 1;
}

message getRequest {
uint64 key = 1;
}

message getReply {
Error err = 1;
bytes value = 2;
}

message conditionalPutRequest {
uint64 key = 1;
bytes expectedValue = 2;
bytes newValue = 3;
}

message conditionalPutReply {
Error err = 1;
bool success = 2;
}

message installShardRequest {
uint64 sid = 1;
// This might be tricky since now the proto files aren't standalone
mapU64ToBytes kvs = 2;
}

message moveShardRequest {
uint64 sid = 1;
// De-alias HostName to uint64
uint64 hostName = 2;
}

message shardMap {
repeated uint64 shards = 1;
}
15 changes: 15 additions & 0 deletions paxi/comulti/comulti.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

message prepareReply {
bool success = 1;
// De-alias Entry to uint64
repeated uint64 log = 2;
uint64 pn = 3;
}

message proposeArgs {
uint64 pn = 1;
uint64 commiteIndex = 2;
// De-alias Entry to uint64
repeated uint64 log = 3;
}
31 changes: 31 additions & 0 deletions paxi/reconf/reconf.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

message config {
// De-alias grove_ffi.Address to uint64
repeated uint64 memebers = 1;
// De-alias grove_ffi.Address to uint64
repeated uint64 nextMembers = 2;
}

message monotonicValue {
uint64 version = 1;
bytes val = 2;
config conf = 3;
}

message prepareReply {
// Maybe should be enum?
uint64 err = 1;
uint64 term = 2;
monotonicValue val = 3;
}

message proposeArgs {
uint64 term = 1;
monotonicValue val = 2;
}

message tryCommitReply {
uint64 err = 1;
uint64 version = 2;
}
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[project]
name = "gokv"
version = "2024.0.0"
dependencies = [
"ruff==0.8.1",
]
33 changes: 33 additions & 0 deletions reconfig/replica/replica.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";

message appendArgs {
uint64 epoch = 1;
// De-aliasing LogEntry to []byte
bytes entry = 2;
uint64 index = 3;
}

message configuration {
// De-aliasing grove_ffi.Address to uint64
repeated uint64 replicas = 1;
}

message becomeReplicaArgs {
uint64 epoch = 1;
uint64 startIndex = 2;
// De-aliasing LogEntry to []byte
repeated bytes log = 3;
}

message becomePrimaryArgs {
uint64 epoch = 1;
configuration conf = 2;
}

message getLogReply {
// De-aliasing Error to uint64. Should this be an enum?
uint64 err = 1;
// De-aliasing LogEntry to []byte
repeated bytes log = 2;
uint64 startIndex = 3;
}
6 changes: 6 additions & 0 deletions reconfig/util/membership.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
syntax = "proto3";

message configuration {
// De-alias grove_ffi.Address to uint64
repeated uint64 addrs = 1;
}
Loading

0 comments on commit 05dfe0e

Please sign in to comment.