Ejemplo n.º 1
0
func NewServer(root string, l net.Listener) (*Server, error) {
	srv := &Server{
		stdfs:  std.New(root),
		rpcSrv: rpc.NewServer(),
	}

	srv.rpcSrv.Register("RemoteFS", srv)
	go srv.rpcSrv.Accept(l)

	return srv, nil
}
Ejemplo n.º 2
0
func NewTCPServer(root, hostport string) (*Server, error) {
	srv := &Server{
		stdfs:  std.New(root),
		rpcSrv: rpc.NewServer(),
	}

	srv.rpcSrv.Register("RemoteFS", srv)
	srv.rpcSrv.TCPListen(hostport)

	return srv, nil
}
Ejemplo n.º 3
0
	"github.com/shaladdle/goaaw/filestore"
	"github.com/shaladdle/goaaw/filestore/remote"
	"github.com/shaladdle/goaaw/filestore/std"
	"github.com/shaladdle/goaaw/filestore/util"
	"github.com/shaladdle/goaaw/testutil"
)

type testInfo struct {
	name  string
	setup func(*testing.T) (fs.FileStore, func(), error)
}

var tests = []testInfo{
	{"std", func(t *testing.T) (fs.FileStore, func(), error) {
		te := testutil.NewTestEnv("testcase-stdfs", t)
		return std.New(te.Root()), func() { te.Teardown() }, nil
	}},
	{"remote", func(t *testing.T) (fs.FileStore, func(), error) {
		const hostport = "localhost:9000"

		te := testutil.NewTestEnv("testcase-net-remotefs", t)

		srv, err := remote.NewTCPServer(te.Root(), hostport)
		if err != nil {
			return nil, nil, err
		}

		cli, err := remote.NewTCPClient(hostport)
		if err != nil {
			return nil, nil, err
		}
Ejemplo n.º 4
0
func NewDiskStore(root string) BlkStore {
	return &diskstore{std.New(root)}
}