-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
181 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package api | ||
|
||
import ( | ||
"context" | ||
|
||
wakunode "github.com/waku-org/go-waku/waku/v2/node" | ||
proto "github.com/xmtp/proto/v3/go/message_api/v3" | ||
"github.com/xmtp/xmtp-node-go/pkg/mlsstore" | ||
"github.com/xmtp/xmtp-node-go/pkg/store" | ||
"go.uber.org/zap" | ||
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
emptypb "google.golang.org/protobuf/types/known/emptypb" | ||
) | ||
|
||
type Service struct { | ||
proto.UnimplementedMlsApiServer | ||
|
||
log *zap.Logger | ||
waku *wakunode.WakuNode | ||
messageStore *store.Store | ||
mlsStore mlsstore.MlsStore | ||
|
||
ctx context.Context | ||
ctxCancel func() | ||
} | ||
|
||
func NewService(node *wakunode.WakuNode, logger *zap.Logger, messageStore *store.Store, mlsStore mlsstore.MlsStore) (s *Service, err error) { | ||
s = &Service{ | ||
log: logger.Named("message/v3"), | ||
waku: node, | ||
messageStore: messageStore, | ||
mlsStore: mlsStore, | ||
} | ||
|
||
s.ctx, s.ctxCancel = context.WithCancel(context.Background()) | ||
|
||
return s, nil | ||
} | ||
|
||
func (s *Service) Close() { | ||
if s.ctxCancel != nil { | ||
s.ctxCancel() | ||
} | ||
} | ||
|
||
func (s *Service) RegisterInstallation(ctx context.Context, req *proto.RegisterInstallationRequest) (*proto.RegisterInstallationResponse, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) ConsumeKeyPackages(ctx context.Context, req *proto.ConsumeKeyPackagesRequest) (*proto.ConsumeKeyPackagesResponse, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) PublishToGroup(ctx context.Context, req *proto.PublishToGroupRequest) (*emptypb.Empty, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) PublishWelcomes(ctx context.Context, req *proto.PublishWelcomesRequest) (*emptypb.Empty, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) UploadKeyPackages(ctx context.Context, req *proto.UploadKeyPackagesRequest) (*emptypb.Empty, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) RevokeInstallation(ctx context.Context, req *proto.RevokeInstallationRequest) (*emptypb.Empty, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} | ||
|
||
func (s *Service) GetIdentityUpdates(ctx context.Context, req *proto.GetIdentityUpdatesRequest) (*proto.GetIdentityUpdatesResponse, error) { | ||
return nil, status.Errorf(codes.Unimplemented, "unimplemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package mlsstore | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/uptrace/bun" | ||
"go.uber.org/zap" | ||
) | ||
|
||
type MlsOptions struct { | ||
DbConnectionString string `long:"db-connection-string" description:"Connection string for MLS DB"` | ||
ReadTimeout time.Duration `long:"read-timeout" description:"Timeout for reading from the database" default:"10s"` | ||
WriteTimeout time.Duration `long:"write-timeout" description:"Timeout for writing to the database" default:"10s"` | ||
MaxOpenConns int `long:"max-open-conns" description:"Maximum number of open connections" default:"80"` | ||
} | ||
|
||
type Config struct { | ||
Log *zap.Logger | ||
DB *bun.DB | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package mlsstore | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/uptrace/bun" | ||
"go.uber.org/zap" | ||
) | ||
|
||
type Store struct { | ||
ctx context.Context | ||
cancel context.CancelFunc | ||
log *zap.Logger | ||
db *bun.DB | ||
} | ||
|
||
type MlsStore interface { | ||
} | ||
|
||
func New(config Config) (*Store, error) { | ||
s := &Store{ | ||
log: config.Log.Named("mlsstore"), | ||
db: config.DB, | ||
} | ||
s.ctx, s.cancel = context.WithCancel(context.Background()) | ||
|
||
return s, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters