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

Move internal/api/* to api/* #129

Merged
merged 3 commits into from
Jul 17, 2023
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
42 changes: 21 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,55 @@ capnp: capnp-anchor capnp-pubsub capnp-cluster capnp-channel capnp-process capnp
# on the GOPATH.

capnp-anchor:
@mkdir -p internal/api/anchor
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:internal/api/anchor --src-prefix=api api/anchor.capnp
@mkdir -p api/anchor
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:api/anchor --src-prefix=api api/anchor.capnp

capnp-pubsub:
@mkdir -p internal/api/pubsub
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:internal/api/pubsub --src-prefix=api api/pubsub.capnp
@mkdir -p api/pubsub
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:api/pubsub --src-prefix=api api/pubsub.capnp

capnp-cluster:
@mkdir -p internal/api/cluster
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:internal/api/cluster --src-prefix=api api/cluster.capnp
@mkdir -p api/cluster
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:api/cluster --src-prefix=api api/cluster.capnp

capnp-channel:
@mkdir -p internal/api/channel
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:internal/api/channel --src-prefix=api api/channel.capnp
@mkdir -p api/channel
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:api/channel --src-prefix=api api/channel.capnp

capnp-process:
@mkdir -p internal/api/process
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:internal/api/process --src-prefix=api api/process.capnp
@mkdir -p api/process
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:api/process --src-prefix=api api/process.capnp

capnp-registry:
@mkdir -p internal/api/registry
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:internal/api/registry --src-prefix=api api/registry.capnp
@mkdir -p api/registry
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:api/registry --src-prefix=api api/registry.capnp

capnp-bitswap:
@mkdir -p internal/api/bitswap
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:internal/api/bitswap --src-prefix=api api/bitswap.capnp
@mkdir -p api/bitswap
@capnp compile -I$(GOPATH)/src/capnproto.org/go/capnp/std -ogo:api/bitswap --src-prefix=api api/bitswap.capnp

clean-capnp: clean-capnp-anchor clean-capnp-pubsub clean-capnp-cluster clean-capnp-channel clean-capnp-process clean-capnp-registry clean-capnp-bitswap

clean-capnp-anchor:
@rm -rf internal/api/anchor
@rm -rf api/anchor

clean-capnp-pubsub:
@rm -rf internal/api/pubsub
@rm -rf api/pubsub

clean-capnp-cluster:
@rm -rf internal/api/cluster
@rm -rf api/cluster

clean-capnp-channel:
@rm -rf internal/api/channel
@rm -rf api/channel

clean-capnp-process:
@rm -rf internal/api/process
@rm -rf api/process

clean-capnp-registry:
@rm -rf internal/api/registry
@rm -rf api/registry

clean-capnp-bitswap:
@rm -rf internal/api/bitswap
@rm -rf api/bitswap

mocks: clean-mocks
# This roundabout call to 'go generate' allows us to:
Expand Down
2 changes: 1 addition & 1 deletion api/anchor.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Go = import "/go.capnp";
@0xefb5a91f96d44de3;

$Go.package("anchor");
$Go.import("github.com/wetware/ww/internal/api/anchor");
$Go.import("github.com/wetware/ww/api/anchor");


interface Anchor {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion api/bitswap.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Go = import "/go.capnp";
@0xced7a3b0e18b5291;

$Go.package("bitswap");
$Go.import("github.com/wetware/ww/internal/api/bitswap");
$Go.import("github.com/wetware/ww/api/bitswap");


interface BitSwap {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion api/channel.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Go = import "/go.capnp";
@0x872a451f9aa74ebf;

$Go.package("channel");
$Go.import("github.com/wetware/ww/internal/api/channel");
$Go.import("github.com/wetware/ww/api/channel");


interface Closer {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion api/cluster.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Go = import "/go.capnp";
@0xfcf6ac08e448a6ac;

$Go.package("cluster");
$Go.import("github.com/wetware/ww/internal/api/cluster");
$Go.import("github.com/wetware/ww/api/cluster");


interface Host {
Expand Down

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

2 changes: 1 addition & 1 deletion api/process.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Go = import "/go.capnp";
@0x9a51e53177277763;

$Go.package("process");
$Go.import("github.com/wetware/ww/internal/api/process");
$Go.import("github.com/wetware/ww/api/process");


interface Executor {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion api/pubsub.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Go = import "/go.capnp";
@0xf9d8a0180405d9ed;

$Go.package("pubsub");
$Go.import("github.com/wetware/ww/internal/api/pubsub");
$Go.import("github.com/wetware/ww/api/pubsub");


interface Topic {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion api/registry.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Go = import "/go.capnp";
@0xfcba4f486a351ac3;

$Go.package("registry");
$Go.import("github.com/wetware/ww/internal/api/registry");
$Go.import("github.com/wetware/ww/api/registry");


using Envelope = Data;
Expand Down

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

6 changes: 3 additions & 3 deletions guest/tinygo/ww.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"capnproto.org/go/capnp/v3/rpc"

"github.com/wetware/ww/internal/api/cluster"
api "github.com/wetware/ww/api/cluster"

"github.com/stealthrocket/wazergo/types"
)
Expand All @@ -16,8 +16,8 @@ var conn = rpc.NewConn(rpc.NewStreamTransport(hostPipe{}), nil)

// Bootstrap returns the host capability exported by the Wetware
// runtime.
func Bootstrap(ctx context.Context) cluster.Host {
return cluster.Host(conn.Bootstrap(ctx))
func Bootstrap(ctx context.Context) api.Host {
return api.Host(conn.Bootstrap(ctx))
}

type hostPipe struct{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/anchor/anchor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"

"capnproto.org/go/capnp/v3"
api "github.com/wetware/ww/internal/api/anchor"
api "github.com/wetware/ww/api/anchor"
"github.com/wetware/ww/pkg/internal/bounded"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/anchor/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync/atomic"

"capnproto.org/go/capnp/v3"
api "github.com/wetware/ww/internal/api/anchor"
api "github.com/wetware/ww/api/anchor"
)

type Node struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/bitswap/bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"capnproto.org/go/capnp/v3"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
api "github.com/wetware/ww/internal/api/bitswap"
api "github.com/wetware/ww/api/bitswap"
)

// Exchange is the local peer's BitSwap exchange. It is wrapped by Server
Expand Down
2 changes: 1 addition & 1 deletion pkg/csp/chan.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"capnproto.org/go/capnp/v3"
casm "github.com/wetware/casm/pkg"
api "github.com/wetware/ww/internal/api/channel"
api "github.com/wetware/ww/api/channel"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/csp/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"lukechampine.com/blake3"

wasm "github.com/tetratelabs/wazero/api"
api "github.com/wetware/ww/internal/api/process"
api "github.com/wetware/ww/api/process"
"github.com/wetware/ww/pkg/csp/proc"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/csp/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/tetratelabs/wazero/sys"

casm "github.com/wetware/casm/pkg"
api "github.com/wetware/ww/internal/api/process"
api "github.com/wetware/ww/api/process"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/csp/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"

"capnproto.org/go/capnp/v3"
api "github.com/wetware/ww/internal/api/channel"
api "github.com/wetware/ww/api/channel"
)

var _ ChanServer = (*SyncChan)(nil)
Expand Down
10 changes: 5 additions & 5 deletions pkg/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

casm "github.com/wetware/casm/pkg"
"github.com/wetware/casm/pkg/cluster"
anchor_api "github.com/wetware/ww/internal/api/anchor"
api "github.com/wetware/ww/internal/api/cluster"
process_api "github.com/wetware/ww/internal/api/process"
pubsub_api "github.com/wetware/ww/internal/api/pubsub"
reg_api "github.com/wetware/ww/internal/api/registry"
anchor_api "github.com/wetware/ww/api/anchor"
api "github.com/wetware/ww/api/cluster"
process_api "github.com/wetware/ww/api/process"
pubsub_api "github.com/wetware/ww/api/pubsub"
reg_api "github.com/wetware/ww/api/registry"
"github.com/wetware/ww/pkg/anchor"
"github.com/wetware/ww/pkg/csp"
"github.com/wetware/ww/pkg/pubsub"
Expand Down
2 changes: 1 addition & 1 deletion pkg/pubsub/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package pubsub
import (
"context"

api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/api/pubsub"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion pkg/pubsub/refcount.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
capnp "capnproto.org/go/capnp/v3"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/lthibault/log"
api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/api/pubsub"
)

// topicManager is responsible for refcounting *pubsub.Topic instances.
Expand Down
2 changes: 1 addition & 1 deletion pkg/pubsub/refcount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
logtest "github.com/lthibault/log/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/api/pubsub"
)

func TestTopicManager(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/pubsub/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
capnp "capnproto.org/go/capnp/v3"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/lthibault/log"
api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/api/pubsub"
)

// Router is a client capability that confers the right to join pubsub
Expand Down
2 changes: 1 addition & 1 deletion pkg/pubsub/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"capnproto.org/go/capnp/v3/exp/bufferpool"
casm "github.com/wetware/casm/pkg"
api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/api/pubsub"
)

// Subscription is a stateful iterator over a stream of topic messages.
Expand Down
2 changes: 1 addition & 1 deletion pkg/pubsub/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/lthibault/log"

casm "github.com/wetware/casm/pkg"
api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/api/pubsub"
)

// Topic is the handle for a pubsub topic. It is used to publish to
Expand Down
2 changes: 1 addition & 1 deletion pkg/pubsub/topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/api/pubsub"
mock_pubsub "github.com/wetware/ww/internal/mock/pkg/pubsub"
"github.com/wetware/ww/pkg/pubsub"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/registry/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"capnproto.org/go/capnp/v3"
"github.com/libp2p/go-libp2p/core/record"
casm "github.com/wetware/casm/pkg"
chan_api "github.com/wetware/ww/internal/api/channel"
ps_api "github.com/wetware/ww/internal/api/pubsub"
api "github.com/wetware/ww/internal/api/registry"
chan_api "github.com/wetware/ww/api/channel"
ps_api "github.com/wetware/ww/api/pubsub"
api "github.com/wetware/ww/api/registry"
"github.com/wetware/ww/pkg/pubsub"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
inproc "github.com/lthibault/go-libp2p-inproc-transport"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
api "github.com/wetware/ww/internal/api/registry"
api "github.com/wetware/ww/api/registry"
pscap "github.com/wetware/ww/pkg/pubsub"
service "github.com/wetware/ww/pkg/registry"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/registry/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"

"capnproto.org/go/capnp/v3"
"github.com/wetware/ww/internal/api/channel"
api "github.com/wetware/ww/internal/api/registry"
"github.com/wetware/ww/api/channel"
api "github.com/wetware/ww/api/registry"
"github.com/wetware/ww/pkg/pubsub"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"capnproto.org/go/capnp/v3"
"github.com/libp2p/go-libp2p-core/record"
ma "github.com/multiformats/go-multiaddr"
api "github.com/wetware/ww/internal/api/registry"
api "github.com/wetware/ww/api/registry"
)

// TODO: register this once stable.
Expand Down