Skip to content

Commit

Permalink
Merge pull request #34 from relab/reuse-datatypes
Browse files Browse the repository at this point in the history
Rearchitected the datatypes to be more appropriately named.
  • Loading branch information
meling authored Sep 21, 2017
2 parents 1b7f6fd + be6b3d0 commit 35059f7
Show file tree
Hide file tree
Showing 25 changed files with 599 additions and 610 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ templates:
.PHONY: dev
dev: static templates reinstallprotoc
@echo generating _gen.go files for dev
mkdir $(TMP_DEVGEN_DIR)
mkdir -p $(TMP_DEVGEN_DIR)
$(GORUMS_ENV_GENDEV) protoc -I=$(PROTOC_I_FLAG) --$(PROTOC_PLUGIN_NAME)=plugins=grpc+gorums:$(TMP_DEVGEN_DIR) $(REG_PROTO_DEV_RPATH)
rm -r $(TMP_DEVGEN_DIR)

Expand Down
27 changes: 2 additions & 25 deletions dev/calltype_correctable.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package {{.PackageName}}

import (
"sync"
"time"

"golang.org/x/net/context"
Expand All @@ -22,23 +21,7 @@ import (

{{if .Correctable}}

/* Exported types and methods for correctable method {{.MethodName}} */

// {{.TypeName}} is a reference to a correctable {{.MethodName}} quorum call.
type {{.TypeName}} struct {
mu sync.Mutex
// the actual reply
*{{.FQCustomRespName}}
NodeIDs []uint32
level int
err error
done bool
watchers []*struct {
level int
ch chan struct{}
}
donech chan struct{}
}
/* Exported correctable method {{.MethodName}} */

{{if .PerNodeArg}}

Expand Down Expand Up @@ -146,13 +129,7 @@ func (c *{{.TypeName}}) set(reply *{{.FQCustomRespName}}, level int, err error,
c.mu.Unlock()
}

/* Unexported types and methods for correctable method {{.MethodName}} */

type {{.UnexportedTypeName}} struct {
nid uint32
reply *{{.FQRespName}}
err error
}
/* Unexported correctable method {{.MethodName}} */

{{template "unexported_method_signature" . -}}
{{- template "trace" .}}
Expand Down
53 changes: 15 additions & 38 deletions dev/calltype_correctable_gen.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package {{.PackageName}}

import (
"io"
"sync"
"time"

"golang.org/x/net/context"
Expand All @@ -16,26 +15,9 @@ import (

{{range $elm := .Services}}

{{if .CorrectablePrelim}}

/* Exported types and methods for correctable prelim method {{.MethodName}} */

// {{.TypeName}} is a reference to a correctable quorum call
// with server side preliminary reply support.
type {{.TypeName}} struct {
mu sync.Mutex
// the actual reply
*{{.FQCustomRespName}}
NodeIDs []uint32
level int
err error
done bool
watchers []*struct {
level int
ch chan struct{}
}
donech chan struct{}
}
{{if .CorrectableStream}}

/* Exported correctable stream method {{.MethodName}} */

{{if .PerNodeArg}}

Expand Down Expand Up @@ -143,13 +125,7 @@ func (c *{{.TypeName}}) set(reply *{{.FQCustomRespName}}, level int, err error,
c.mu.Unlock()
}

/* Unexported types and methods for correctable prelim method {{.MethodName}} */

type {{.UnexportedTypeName}} struct {
nid uint32
reply *{{.FQRespName}}
err error
}
/* Unexported correctable stream method {{.MethodName}} */

{{template "unexported_method_signature" . -}}
{{- template "trace" .}}
Expand Down
Loading

0 comments on commit 35059f7

Please sign in to comment.