/
init.go
35 lines (26 loc) · 1013 Bytes
/
init.go
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
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package bidi
import (
"time"
"v.io/v23/context"
"v.io/v23/flow"
)
const Name = "bidi"
func init() {
flow.RegisterProtocol(Name, Bidi{})
}
// Bidi protocol represents the protocol to make a bidirectional RPC. Dial, Resolve, and Listen
// all fail on the Bidi protocol because the RoutingID of the end server must already be in the
// flow.Manager's cache for the bidirectional call to succeed.
type Bidi struct{}
func (Bidi) Dial(ctx *context.T, network, address string, timeout time.Duration) (flow.Conn, error) {
return nil, NewErrBidiRoutingIdNotCached(ctx)
}
func (Bidi) Resolve(ctx *context.T, network, address string) (string, []string, error) {
return "", nil, NewErrBidiRoutingIdNotCached(ctx)
}
func (Bidi) Listen(ctx *context.T, network, address string) (flow.Listener, error) {
return nil, NewErrCannotListenOnBidi(ctx)
}