Skip to content
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

Service -> Net #270

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish-grpc-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Get JS dependencies
run: |
cd api/pb/javascript && npm install
cd ../../../service/api/pb/javascript && npm install
cd ../../../net/api/pb/javascript && npm install
npm install -g json
npm install -g yaml-cli
- name: Get Dart dependencies
Expand All @@ -58,7 +58,7 @@ jobs:
make clean && make
- name: Protoc generate Service
run: |
cd service/api/pb
cd net/api/pb
make clean && make
- name: Publish JS API
env:
Expand All @@ -71,7 +71,7 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
cd service/api/pb/javascript
cd net/api/pb/javascript
json -I -f package.json -e 'this.version=("${{ steps.latesttag.outputs.tag }}").replace("v", "")'
npm publish --access=public
- name: Publish Dart API
Expand Down
3 changes: 1 addition & 2 deletions api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"reflect"

ma "github.com/multiformats/go-multiaddr"
pb "github.com/textileio/go-threads/api/pb"
"github.com/textileio/go-threads/core/thread"
"github.com/textileio/go-threads/crypto/symmetric"

pb "github.com/textileio/go-threads/api/pb"
"github.com/textileio/go-threads/db"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down
10 changes: 5 additions & 5 deletions api/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,14 @@ func makeServer(t *testing.T) (ma.Multiaddr, func()) {
if err != nil {
t.Fatal(err)
}
ts, err := db.DefaultService(
n, err := db.DefaultNetwork(
dir,
db.WithServiceDebug(true))
db.WithNetDebug(true))
if err != nil {
t.Fatal(err)
}
ts.Bootstrap(util.DefaultBoostrapPeers())
service, err := api.NewService(ts, api.Config{
n.Bootstrap(util.DefaultBoostrapPeers())
service, err := api.NewService(n, api.Config{
RepoPath: dir,
Debug: true,
})
Expand Down Expand Up @@ -610,7 +610,7 @@ func makeServer(t *testing.T) (ma.Multiaddr, func()) {
return addr, func() {
time.Sleep(time.Second) // Give threads a chance to finish work
server.GracefulStop()
if err := ts.Close(); err != nil {
if err := n.Close(); err != nil {
t.Fatal(err)
}
_ = os.RemoveAll(dir)
Expand Down
156 changes: 78 additions & 78 deletions api/pb/api.pb.go

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

2 changes: 1 addition & 1 deletion api/pb/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package api.pb;
option java_multiple_files = true;
option java_package = "io.textile.threads_grpc";
option java_outer_classname = "Threads";
option objc_class_prefix = "THRDS";
option objc_class_prefix = "THREADS";

message NewDBRequest {
string dbID = 1;
Expand Down
12 changes: 6 additions & 6 deletions api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
ma "github.com/multiformats/go-multiaddr"
pb "github.com/textileio/go-threads/api/pb"
coredb "github.com/textileio/go-threads/core/db"
core "github.com/textileio/go-threads/core/service"
"github.com/textileio/go-threads/core/net"
"github.com/textileio/go-threads/core/thread"
sym "github.com/textileio/go-threads/crypto/symmetric"
"github.com/textileio/go-threads/db"
Expand All @@ -35,8 +35,8 @@ type Config struct {
}

// NewService starts and returns a new service with the given threadservice.
// The threadservice is *not* managed by the server.
func NewService(ts core.Service, conf Config) (*Service, error) {
// The threadnet is *not* managed by the server.
func NewService(network net.Net, conf Config) (*Service, error) {
var err error
if conf.Debug {
err = util.SetLogLevels(map[string]logging.LogLevel{
Expand All @@ -48,7 +48,7 @@ func NewService(ts core.Service, conf Config) (*Service, error) {
}

manager, err := db.NewManager(
ts,
network,
db.WithJsonMode(true),
db.WithRepoPath(conf.RepoPath),
db.WithDebug(true))
Expand Down Expand Up @@ -125,11 +125,11 @@ func (s *Service) GetDBInfo(ctx context.Context, req *pb.GetDBInfoRequest) (*pb.
if err != nil {
return nil, err
}
tinfo, err := s.manager.Service().GetThread(ctx, id)
tinfo, err := s.manager.Net().GetThread(ctx, id)
if err != nil {
return nil, err
}
host := s.manager.Service().Host()
host := s.manager.Net().Host()
peerID, _ := ma.NewComponent("p2p", host.ID().String())
threadID, _ := ma.NewComponent("thread", id.String())
addrs := host.Addrs()
Expand Down
Loading