MCPcopy Create free account
hub / github.com/dadgar/onecache / forward

Method forward

onecache/onecache_rpc.go:103–118  ·  view source on GitHub ↗

forward forwards the rpc to the passed target node.

(target, method string, args interface{}, reply interface{})

Source from the content-addressed store, hash-verified

101
102// forward forwards the rpc to the passed target node.
103func (r *rpcServer) forward(target, method string, args interface{}, reply interface{}) error {
104 r.n.lock.Lock()
105 p, ok := r.n.nodes[target]
106 r.n.lock.Unlock()
107 if !ok {
108 return fmt.Errorf("could not dial unknown peer %v", target)
109 }
110
111 addr, err := net.ResolveTCPAddr("tcp", fmt.Sprintf("%s:%d", p.addr, p.port))
112 if err != nil {
113 return fmt.Errorf("Failed to resolve tcp address of peer %v: %v", target, err)
114 }
115
116 err = r.connPool.RPC(addr, method, args, reply)
117 return err
118}
119
120// StorageArgs is the struct used to make data related RPC calls.
121type StorageArgs struct {

Callers 14

SetMethod · 0.95
CasMethod · 0.95
AddMethod · 0.95
ReplaceMethod · 0.95
AppendMethod · 0.95
PrependMethod · 0.95
IncrementMethod · 0.95
DecrementMethod · 0.95
ContainsMethod · 0.95
TouchMethod · 0.95
RemoveMethod · 0.95
GetMethod · 0.95

Calls 1

RPCMethod · 0.80

Tested by

no test coverage detected