-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scaffold identity server #371
Changes from 7 commits
2311938
734fb2e
81a56b1
b41b15b
1f1e668
6137f35
2882580
1d8acca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ if ! which golangci-lint &>/dev/null; then brew install golangci-lint; fi | |
if ! which shellcheck &>/dev/null; then brew install shellcheck; fi | ||
if ! which protoc &>/dev/null; then brew install protobuf; fi | ||
if ! which protoc-gen-go &>/dev/null; then go install google.golang.org/protobuf/cmd/protoc-gen-go@latest; fi | ||
if ! which mockgen &>/dev/null; then go install go.uber.org/mock/mockgen@latest; fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one was a pain to find, but tests were failing until I did this. Basically, it's entirely possible you have a different version of The reason for the use of the uber one seems to be the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch |
||
go install go.uber.org/mock/mockgen@latest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there no way to tell if you have the correct mockgen and only run this if you have the wrong one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I found a hack to only run this if the version is not 0.4.0. Basically we can pin the uber mockgen on the current version of v0.4.0 and update as needed. Should be good indefinitely because it is running behind the golang one, which is on v1.6.0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice work! |
||
if ! which protolint &>/dev/null; then go install github.com/yoheimuta/protolint/cmd/protolint@latest; fi | ||
|
||
dev/generate | ||
|
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package api | ||
|
||
import ( | ||
"context" | ||
|
||
mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store" | ||
api "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" | ||
"go.uber.org/zap" | ||
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
) | ||
|
||
type Service struct { | ||
api.UnimplementedIdentityApiServer | ||
|
||
log *zap.Logger | ||
store mlsstore.MlsStore | ||
|
||
ctx context.Context | ||
ctxCancel func() | ||
} | ||
|
||
func NewService(log *zap.Logger, store mlsstore.MlsStore) (s *Service, err error) { | ||
s = &Service{ | ||
log: log.Named("identity"), | ||
store: store, | ||
} | ||
s.ctx, s.ctxCancel = context.WithCancel(context.Background()) | ||
|
||
s.log.Info("Starting identity service") | ||
return s, nil | ||
} | ||
|
||
func (s *Service) Close() { | ||
s.log.Info("closing") | ||
|
||
if s.ctxCancel != nil { | ||
s.ctxCancel() | ||
} | ||
|
||
s.log.Info("closed") | ||
} | ||
|
||
func (s *Service) PublishIdentityUpdate(ctx context.Context, req *api.PublishIdentityUpdateRequest) (*api.PublishIdentityUpdateResponse, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) GetIdentityUpdates(ctx context.Context, req *api.GetIdentityUpdatesRequest) (*api.GetIdentityUpdatesResponse, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) GetInboxIds(ctx context.Context, req *api.GetInboxIdsRequest) (*api.GetInboxIdsResponse, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of all our projects, this is probably the one that needs a devcontainer the most come to think of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, we should probably invest if more people start working on the backend