-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathstaticpool.go
More file actions
45 lines (35 loc) · 1.05 KB
/
staticpool.go
File metadata and controls
45 lines (35 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package pool
import (
"context"
"errors"
"github.com/vipnode/vipnode/pool/store"
)
// Type assert for Pool implementation.
var _ Pool = &StaticPool{}
// StaticPool is a dummy implementation of a pool service that always returns
// from the same set of host nodes. It does not do any signature checking.
type StaticPool struct {
Nodes []store.Node
}
func (s *StaticPool) AddNode(nodeURI string) error {
// TODO: Parse ID etc?
s.Nodes = append(s.Nodes, store.Node{
URI: nodeURI,
})
return nil
}
func (s *StaticPool) Host(ctx context.Context, req HostRequest) (*HostResponse, error) {
return &HostResponse{}, nil
}
func (s *StaticPool) Client(ctx context.Context, req ClientRequest) (*ClientResponse, error) {
return &ClientResponse{Hosts: s.Nodes}, nil
}
func (s *StaticPool) Disconnect(ctx context.Context) error {
return nil
}
func (s *StaticPool) Update(ctx context.Context, req UpdateRequest) (*UpdateResponse, error) {
return &UpdateResponse{}, nil
}
func (s *StaticPool) Withdraw(ctx context.Context) error {
return errors.New("not implemented")
}