From 4115e2622bc67b4a1bb0586ef226bd1ebdca065f Mon Sep 17 00:00:00 2001 From: Matt Schwennesen Date: Wed, 8 Jan 2025 21:02:34 -0600 Subject: [PATCH] update to use value-based grackle --- flake.nix | 8 +-- tutorial/kvservice/client.go | 8 +-- .../conditionalput_gk/conditionalput_gk.go | 33 +++++++----- tutorial/kvservice/get_gk/get_gk.go | 25 +++++---- tutorial/kvservice/kvservice.proto | 2 +- tutorial/kvservice/kvservice_rpc.gb.go | 6 +-- tutorial/kvservice/put_gk/put_gk.go | 51 +++++++++++-------- tutorial/kvservice/server.go | 8 +-- tutorial/lockservice/1_lock_rpc.gb.go | 4 +- .../lockrequest_gk/lockrequest_gk.go | 21 ++++---- tutorial/objectstore/chunk/client.go | 2 +- tutorial/objectstore/chunk/server.go | 2 +- .../chunk/writechunk_gk/writechunk_gk.go | 31 ++++++----- .../dir/chunkhandle_gk/chunkhandle_gk.go | 25 +++++---- tutorial/objectstore/dir/client.go | 4 +- .../dir/finishwrite_gk/finishwrite_gk.go | 25 +++++---- .../dir/recordchunk_gk/recordchunk_gk.go | 35 ++++++++----- tutorial/objectstore/dir/server.go | 4 +- 18 files changed, 172 insertions(+), 122 deletions(-) diff --git a/flake.nix b/flake.nix index 6b9ae2f..d15486b 100644 --- a/flake.nix +++ b/flake.nix @@ -17,8 +17,8 @@ src = pkgs.fetchFromGitHub { owner = "goose-lang"; repo = "goose"; - rev = "8d13c771b9a80957089f7c5b0ee2ccf58e5eb06f"; - sha256 = "1fbqs75ya4as3my2knkaq4m0crdh3n004grw5g5iczvb5h5k06lz"; + rev = "a4f2f84193d34f56dd84fc623adc43a6441da1eb"; + sha256 = "1b1dfa1qsv2h7hy5x20zhic2npr5gz1zp76m1lab4v490adxj2rx"; }; vendorHash = "sha256-HCJ8v3TSv4UrkOsRuENWVz5Z7zQ1UsOygx0Mo7MELzY="; }; @@ -27,8 +27,8 @@ src = pkgs.fetchFromGitHub { owner = "mjschwenne"; repo = "grackle"; - rev = "ee8a2fbea1c4cef22336a2a1760de5c0ba4a9c72"; - sha256 = "08drdzjgj3006l3hxyiqfvm7y2i8m6hmsc108rj6i1w22kd0pv4g"; + rev = "101412356cdfbcad78f8aaa724101312928c4978"; + sha256 = "06zf2bvrbbjhgrd6994h3wcaml7m83m6f9r61pj7y09xq9nw10br"; }; vendorHash = "sha256-Wk2v0HSAkrzxHJvCfbw6xOn0OQ1xukvYjDxk3c2LmH8="; checkPhase = false; diff --git a/tutorial/kvservice/client.go b/tutorial/kvservice/client.go index 0d1a58e..45b8c38 100644 --- a/tutorial/kvservice/client.go +++ b/tutorial/kvservice/client.go @@ -37,10 +37,10 @@ func (ck *Clerk) Put(key string, val string) { for { // TODO: allocate these once, outside the loop. Waiting to do this until // heap has dfrac for convenience. - args := &put_gk.S{ + args := put_gk.S{ OpId: opId, Key: key, - Val: val, + Value: val, } if ck.rpcCl.putRpc(args) == urpc.ErrNone { break @@ -63,7 +63,7 @@ func (ck *Clerk) ConditionalPut(key string, expectedVal string, newVal string) b var ret bool for { - args := &conditionalput_gk.S{ + args := conditionalput_gk.S{ OpId: opId, Key: key, ExpectedVal: expectedVal, @@ -94,7 +94,7 @@ func (ck *Clerk) Get(key string) string { var ret string for { - args := &get_gk.S{ + args := get_gk.S{ OpId: opId, Key: key, } diff --git a/tutorial/kvservice/conditionalput_gk/conditionalput_gk.go b/tutorial/kvservice/conditionalput_gk/conditionalput_gk.go index 091b7d2..45ca40a 100644 --- a/tutorial/kvservice/conditionalput_gk/conditionalput_gk.go +++ b/tutorial/kvservice/conditionalput_gk/conditionalput_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package conditionalput_gk import ( @@ -11,11 +16,7 @@ type S struct { NewVal string } -func (c *S) approxSize() uint64 { - return 0 -} - -func Marshal(c *S, prefix []byte) []byte { +func Marshal(c S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, c.OpId) @@ -32,26 +33,34 @@ func Marshal(c *S, prefix []byte) []byte { return enc } -func Unmarshal(s []byte) (*S, []byte) { - c := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var opId uint64 + var key string + var expectedVal string + var newVal string - c.OpId, enc = marshal.ReadInt(enc) + opId, enc = marshal.ReadInt(enc) var keyLen uint64 var keyBytes []byte keyLen, enc = marshal.ReadInt(enc) keyBytes, enc = marshal.ReadBytesCopy(enc, keyLen) - c.Key = string(keyBytes) + key = string(keyBytes) var expectedValLen uint64 var expectedValBytes []byte expectedValLen, enc = marshal.ReadInt(enc) expectedValBytes, enc = marshal.ReadBytesCopy(enc, expectedValLen) - c.ExpectedVal = string(expectedValBytes) + expectedVal = string(expectedValBytes) var newValLen uint64 var newValBytes []byte newValLen, enc = marshal.ReadInt(enc) newValBytes, enc = marshal.ReadBytesCopy(enc, newValLen) - c.NewVal = string(newValBytes) + newVal = string(newValBytes) - return c, enc + return S{ + OpId: opId, + Key: key, + ExpectedVal: expectedVal, + NewVal: newVal, + }, enc } diff --git a/tutorial/kvservice/get_gk/get_gk.go b/tutorial/kvservice/get_gk/get_gk.go index 3de9e8a..d8430fa 100644 --- a/tutorial/kvservice/get_gk/get_gk.go +++ b/tutorial/kvservice/get_gk/get_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package get_gk import ( @@ -9,11 +14,7 @@ type S struct { Key string } -func (g *S) approxSize() uint64 { - return 0 -} - -func Marshal(g *S, prefix []byte) []byte { +func Marshal(g S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, g.OpId) @@ -24,16 +25,20 @@ func Marshal(g *S, prefix []byte) []byte { return enc } -func Unmarshal(s []byte) (*S, []byte) { - g := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var opId uint64 + var key string - g.OpId, enc = marshal.ReadInt(enc) + opId, enc = marshal.ReadInt(enc) var keyLen uint64 var keyBytes []byte keyLen, enc = marshal.ReadInt(enc) keyBytes, enc = marshal.ReadBytesCopy(enc, keyLen) - g.Key = string(keyBytes) + key = string(keyBytes) - return g, enc + return S{ + OpId: opId, + Key: key, + }, enc } diff --git a/tutorial/kvservice/kvservice.proto b/tutorial/kvservice/kvservice.proto index 4f78714..b7e15f0 100644 --- a/tutorial/kvservice/kvservice.proto +++ b/tutorial/kvservice/kvservice.proto @@ -3,7 +3,7 @@ syntax = "proto3"; message put { uint64 opId = 1; string key = 2; - string val = 3; + string value = 3; } message conditionalPut { diff --git a/tutorial/kvservice/kvservice_rpc.gb.go b/tutorial/kvservice/kvservice_rpc.gb.go index 9327da7..189d495 100644 --- a/tutorial/kvservice/kvservice_rpc.gb.go +++ b/tutorial/kvservice/kvservice_rpc.gb.go @@ -30,7 +30,7 @@ func (cl *Client) getFreshNumRpc() (uint64, Error) { return 0, err } -func (cl *Client) putRpc(args *put_gk.S) Error { +func (cl *Client) putRpc(args put_gk.S) Error { var reply []byte err := cl.cl.Call(rpcIdPut, put_gk.Marshal(args, make([]byte, 0)), &reply, 100) if err == urpc.ErrNone { @@ -39,7 +39,7 @@ func (cl *Client) putRpc(args *put_gk.S) Error { return err } -func (cl *Client) conditionalPutRpc(args *conditionalput_gk.S) (string, Error) { +func (cl *Client) conditionalPutRpc(args conditionalput_gk.S) (string, Error) { var reply []byte err := cl.cl.Call(rpcIdConditionalPut, conditionalput_gk.Marshal(args, make([]byte, 0)), &reply, 100) if err == urpc.ErrNone { @@ -48,7 +48,7 @@ func (cl *Client) conditionalPutRpc(args *conditionalput_gk.S) (string, Error) { return "", err } -func (cl *Client) getRpc(args *get_gk.S) (string, Error) { +func (cl *Client) getRpc(args get_gk.S) (string, Error) { var reply []byte err := cl.cl.Call(rpcIdGet, get_gk.Marshal(args, make([]byte, 0)), &reply, 100) if err == urpc.ErrNone { diff --git a/tutorial/kvservice/put_gk/put_gk.go b/tutorial/kvservice/put_gk/put_gk.go index b48d1d5..fadd543 100644 --- a/tutorial/kvservice/put_gk/put_gk.go +++ b/tutorial/kvservice/put_gk/put_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package put_gk import ( @@ -5,44 +10,46 @@ import ( ) type S struct { - OpId uint64 - Key string - Val string -} - -func (p *S) approxSize() uint64 { - return 0 + OpId uint64 + Key string + Value string } -func Marshal(p *S, prefix []byte) []byte { +func Marshal(p S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, p.OpId) keyBytes := []byte(p.Key) enc = marshal.WriteInt(enc, uint64(len(keyBytes))) enc = marshal.WriteBytes(enc, keyBytes) - valBytes := []byte(p.Val) - enc = marshal.WriteInt(enc, uint64(len(valBytes))) - enc = marshal.WriteBytes(enc, valBytes) + valueBytes := []byte(p.Value) + enc = marshal.WriteInt(enc, uint64(len(valueBytes))) + enc = marshal.WriteBytes(enc, valueBytes) return enc } -func Unmarshal(s []byte) (*S, []byte) { - p := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var opId uint64 + var key string + var value string - p.OpId, enc = marshal.ReadInt(enc) + opId, enc = marshal.ReadInt(enc) var keyLen uint64 var keyBytes []byte keyLen, enc = marshal.ReadInt(enc) keyBytes, enc = marshal.ReadBytesCopy(enc, keyLen) - p.Key = string(keyBytes) - var valLen uint64 - var valBytes []byte - valLen, enc = marshal.ReadInt(enc) - valBytes, enc = marshal.ReadBytesCopy(enc, valLen) - p.Val = string(valBytes) - - return p, enc + key = string(keyBytes) + var valueLen uint64 + var valueBytes []byte + valueLen, enc = marshal.ReadInt(enc) + valueBytes, enc = marshal.ReadBytesCopy(enc, valueLen) + value = string(valueBytes) + + return S{ + OpId: opId, + Key: key, + Value: value, + }, enc } diff --git a/tutorial/kvservice/server.go b/tutorial/kvservice/server.go index d0cf375..a697bc3 100644 --- a/tutorial/kvservice/server.go +++ b/tutorial/kvservice/server.go @@ -24,19 +24,19 @@ func (s *Server) getFreshNum() uint64 { return n } -func (s *Server) put(args *put_gk.S) { +func (s *Server) put(args put_gk.S) { s.mu.Lock() _, ok := s.lastReplies[args.OpId] if ok { s.mu.Unlock() return } - s.kvs[args.Key] = args.Val + s.kvs[args.Key] = args.Value s.lastReplies[args.OpId] = "" s.mu.Unlock() } -func (s *Server) conditionalPut(args *conditionalput_gk.S) string { +func (s *Server) conditionalPut(args conditionalput_gk.S) string { s.mu.Lock() ret, ok := s.lastReplies[args.OpId] if ok { @@ -54,7 +54,7 @@ func (s *Server) conditionalPut(args *conditionalput_gk.S) string { return ret2 } -func (s *Server) get(args *get_gk.S) string { +func (s *Server) get(args get_gk.S) string { s.mu.Lock() ret, ok := s.lastReplies[args.OpId] if ok { diff --git a/tutorial/lockservice/1_lock_rpc.gb.go b/tutorial/lockservice/1_lock_rpc.gb.go index 720aacd..f3bf980 100644 --- a/tutorial/lockservice/1_lock_rpc.gb.go +++ b/tutorial/lockservice/1_lock_rpc.gb.go @@ -30,7 +30,7 @@ func (cl *Client) getFreshNum() (uint64, Error) { func (cl *Client) tryAcquire(id uint64) (uint64, Error) { var reply []byte - args := lockrequest_gk.Marshal(&lockrequest_gk.S{Id: id}, []byte{}) + args := lockrequest_gk.Marshal(lockrequest_gk.S{Id: id}, []byte{}) err := cl.cl.Call(RPC_TRY_ACQUIRE, args, &reply, 100) if err == urpc.ErrNone { return DecodeUint64(reply), err @@ -40,7 +40,7 @@ func (cl *Client) tryAcquire(id uint64) (uint64, Error) { func (cl *Client) release(id uint64) Error { var reply []byte - args := lockrequest_gk.Marshal(&lockrequest_gk.S{Id: id}, []byte{}) + args := lockrequest_gk.Marshal(lockrequest_gk.S{Id: id}, []byte{}) return cl.cl.Call(RPC_RELEASE, args, &reply, 100) } diff --git a/tutorial/lockservice/lockrequest_gk/lockrequest_gk.go b/tutorial/lockservice/lockrequest_gk/lockrequest_gk.go index 9aa2c0b..547d38d 100644 --- a/tutorial/lockservice/lockrequest_gk/lockrequest_gk.go +++ b/tutorial/lockservice/lockrequest_gk/lockrequest_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package lockrequest_gk import ( @@ -8,11 +13,7 @@ type S struct { Id uint64 } -func (l *S) approxSize() uint64 { - return 0 -} - -func Marshal(l *S, prefix []byte) []byte { +func Marshal(l S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, l.Id) @@ -20,11 +21,13 @@ func Marshal(l *S, prefix []byte) []byte { return enc } -func Unmarshal(s []byte) (*S, []byte) { - l := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var id uint64 - l.Id, enc = marshal.ReadInt(enc) + id, enc = marshal.ReadInt(enc) - return l, enc + return S{ + Id: id, + }, enc } diff --git a/tutorial/objectstore/chunk/client.go b/tutorial/objectstore/chunk/client.go index ff289da..c446162 100644 --- a/tutorial/objectstore/chunk/client.go +++ b/tutorial/objectstore/chunk/client.go @@ -20,7 +20,7 @@ type ClerkPool struct { } func (ck *ClerkPool) WriteChunk(addr grove_ffi.Address, args writechunk_gk.S) { - req := writechunk_gk.Marshal(&args, make([]byte, 0)) + req := writechunk_gk.Marshal(args, make([]byte, 0)) reply := new([]byte) ck.cm.CallAtLeastOnce(addr, WriteChunkId, req, reply, 100 /*ms*/) } diff --git a/tutorial/objectstore/chunk/server.go b/tutorial/objectstore/chunk/server.go index 0ec4e1b..5405166 100644 --- a/tutorial/objectstore/chunk/server.go +++ b/tutorial/objectstore/chunk/server.go @@ -49,7 +49,7 @@ func StartServer(me grove_ffi.Address, dir_addr grove_ffi.Address) { handlers := make(map[uint64]func([]byte, *[]byte)) handlers[WriteChunkId] = func(req []byte, reply *[]byte) { args, _ := writechunk_gk.Unmarshal(req) - s.WriteChunk(*args) + s.WriteChunk(args) *reply = make([]byte, 0) // TODO: is this needed? } handlers[GetChunkId] = func(req []byte, reply *[]byte) { diff --git a/tutorial/objectstore/chunk/writechunk_gk/writechunk_gk.go b/tutorial/objectstore/chunk/writechunk_gk/writechunk_gk.go index a336d7b..ff75936 100644 --- a/tutorial/objectstore/chunk/writechunk_gk/writechunk_gk.go +++ b/tutorial/objectstore/chunk/writechunk_gk/writechunk_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package writechunk_gk import ( @@ -10,11 +15,7 @@ type S struct { Index uint64 } -func (w *S) approxSize() uint64 { - return 0 -} - -func Marshal(w *S, prefix []byte) []byte { +func Marshal(w S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, w.WriteId) @@ -25,17 +26,23 @@ func Marshal(w *S, prefix []byte) []byte { return enc } -func Unmarshal(s []byte) (*S, []byte) { - w := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var writeId uint64 + var chunk []byte + var index uint64 - w.WriteId, enc = marshal.ReadInt(enc) + writeId, enc = marshal.ReadInt(enc) var chunkLen uint64 var chunkBytes []byte chunkLen, enc = marshal.ReadInt(enc) chunkBytes, enc = marshal.ReadBytesCopy(enc, chunkLen) - w.Chunk = chunkBytes - w.Index, enc = marshal.ReadInt(enc) - - return w, enc + chunk = chunkBytes + index, enc = marshal.ReadInt(enc) + + return S{ + WriteId: writeId, + Chunk: chunk, + Index: index, + }, enc } diff --git a/tutorial/objectstore/dir/chunkhandle_gk/chunkhandle_gk.go b/tutorial/objectstore/dir/chunkhandle_gk/chunkhandle_gk.go index 2e3b823..dc25aad 100644 --- a/tutorial/objectstore/dir/chunkhandle_gk/chunkhandle_gk.go +++ b/tutorial/objectstore/dir/chunkhandle_gk/chunkhandle_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package chunkhandle_gk import ( @@ -9,11 +14,7 @@ type S struct { ContentHash string } -func (c *S) approxSize() uint64 { - return 0 -} - -func Marshal(c *S, prefix []byte) []byte { +func Marshal(c S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, c.Addr) @@ -24,16 +25,20 @@ func Marshal(c *S, prefix []byte) []byte { return enc } -func Unmarshal(s []byte) (*S, []byte) { - c := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var addr uint64 + var contentHash string - c.Addr, enc = marshal.ReadInt(enc) + addr, enc = marshal.ReadInt(enc) var contentHashLen uint64 var contentHashBytes []byte contentHashLen, enc = marshal.ReadInt(enc) contentHashBytes, enc = marshal.ReadBytesCopy(enc, contentHashLen) - c.ContentHash = string(contentHashBytes) + contentHash = string(contentHashBytes) - return c, enc + return S{ + Addr: addr, + ContentHash: contentHash, + }, enc } diff --git a/tutorial/objectstore/dir/client.go b/tutorial/objectstore/dir/client.go index 99ec258..b5dfd9b 100644 --- a/tutorial/objectstore/dir/client.go +++ b/tutorial/objectstore/dir/client.go @@ -36,14 +36,14 @@ func (ck *Clerk) PrepareWrite() PreparedWrite { // From chunk func (ck *Clerk) RecordChunk(args recordchunk_gk.S) { - req := recordchunk_gk.Marshal(&args, make([]byte, 0)) + req := recordchunk_gk.Marshal(args, make([]byte, 0)) reply := new([]byte) ck.client.Call(RecordChunkId, req, reply, 100 /*ms*/) } // From chunk func (ck *Clerk) FinishWrite(args finishwrite_gk.S) { - req := finishwrite_gk.Marshal(&args, make([]byte, 0)) + req := finishwrite_gk.Marshal(args, make([]byte, 0)) reply := new([]byte) ck.client.Call(FinishWriteId, req, reply, 100 /*ms*/) } diff --git a/tutorial/objectstore/dir/finishwrite_gk/finishwrite_gk.go b/tutorial/objectstore/dir/finishwrite_gk/finishwrite_gk.go index 68a69dd..e446c49 100644 --- a/tutorial/objectstore/dir/finishwrite_gk/finishwrite_gk.go +++ b/tutorial/objectstore/dir/finishwrite_gk/finishwrite_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package finishwrite_gk import ( @@ -9,11 +14,7 @@ type S struct { Keyname string } -func (f *S) approxSize() uint64 { - return 0 -} - -func Marshal(f *S, prefix []byte) []byte { +func Marshal(f S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, f.WriteId) @@ -24,16 +25,20 @@ func Marshal(f *S, prefix []byte) []byte { return enc } -func Unmarshal(s []byte) (*S, []byte) { - f := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var writeId uint64 + var keyname string - f.WriteId, enc = marshal.ReadInt(enc) + writeId, enc = marshal.ReadInt(enc) var keynameLen uint64 var keynameBytes []byte keynameLen, enc = marshal.ReadInt(enc) keynameBytes, enc = marshal.ReadBytesCopy(enc, keynameLen) - f.Keyname = string(keynameBytes) + keyname = string(keynameBytes) - return f, enc + return S{ + WriteId: writeId, + Keyname: keyname, + }, enc } diff --git a/tutorial/objectstore/dir/recordchunk_gk/recordchunk_gk.go b/tutorial/objectstore/dir/recordchunk_gk/recordchunk_gk.go index 6ccb578..485e709 100644 --- a/tutorial/objectstore/dir/recordchunk_gk/recordchunk_gk.go +++ b/tutorial/objectstore/dir/recordchunk_gk/recordchunk_gk.go @@ -1,3 +1,8 @@ +//-------------------------------------- +// This file is autogenerated by grackle +// DO NOT MANUALLY EDIT THIS FILE +//-------------------------------------- + package recordchunk_gk import ( @@ -11,11 +16,7 @@ type S struct { Index uint64 } -func (r *S) approxSize() uint64 { - return 0 -} - -func Marshal(r *S, prefix []byte) []byte { +func Marshal(r S, prefix []byte) []byte { var enc = prefix enc = marshal.WriteInt(enc, r.WriteId) @@ -28,18 +29,26 @@ func Marshal(r *S, prefix []byte) []byte { return enc } -func Unmarshal(s []byte) (*S, []byte) { - r := new(S) +func Unmarshal(s []byte) (S, []byte) { var enc = s // Needed for goose compatibility + var writeId uint64 + var server uint64 + var contentHash string + var index uint64 - r.WriteId, enc = marshal.ReadInt(enc) - r.Server, enc = marshal.ReadInt(enc) + writeId, enc = marshal.ReadInt(enc) + server, enc = marshal.ReadInt(enc) var contentHashLen uint64 var contentHashBytes []byte contentHashLen, enc = marshal.ReadInt(enc) contentHashBytes, enc = marshal.ReadBytesCopy(enc, contentHashLen) - r.ContentHash = string(contentHashBytes) - r.Index, enc = marshal.ReadInt(enc) - - return r, enc + contentHash = string(contentHashBytes) + index, enc = marshal.ReadInt(enc) + + return S{ + WriteId: writeId, + Server: server, + ContentHash: contentHash, + Index: index, + }, enc } diff --git a/tutorial/objectstore/dir/server.go b/tutorial/objectstore/dir/server.go index d73a996..22e23d9 100644 --- a/tutorial/objectstore/dir/server.go +++ b/tutorial/objectstore/dir/server.go @@ -93,12 +93,12 @@ func StartServer(me grove_ffi.Address) { } handlers[RecordChunkId] = func(req []byte, reply *[]byte) { args, _ := recordchunk_gk.Unmarshal(req) - s.RecordChunk(*args) + s.RecordChunk(args) *reply = make([]byte, 0) } handlers[FinishWriteId] = func(req []byte, reply *[]byte) { args, _ := finishwrite_gk.Unmarshal(req) - s.FinishWrite(*args) + s.FinishWrite(args) *reply = make([]byte, 0) } handlers[PrepareReadId] = func(req []byte, reply *[]byte) {