Documentation ¶
Index ¶
- Constants
- Variables
- func CtxIdentity(ctx context.Context) ([]byte, error)
- func CtxPeerAddr(ctx context.Context) string
- func CtxPeerClientVersion(ctx context.Context) string
- func CtxPeerId(ctx context.Context) (string, error)
- func CtxPubKey(ctx context.Context) (crypto.PubKey, error)
- func CtxWithClientVersion(ctx context.Context, addr string) context.Context
- func CtxWithIdentity(ctx context.Context, identity []byte) context.Context
- func CtxWithPeerAddr(ctx context.Context, addr string) context.Context
- func CtxWithPeerId(ctx context.Context, peerId string) context.Context
- type Peer
Constants ¶
View Source
const CtxResponsiblePeers = "*"
Variables ¶
View Source
var ( ErrPeerIdNotFoundInContext = errors.New("peer id not found in context") ErrIdentityNotFoundInContext = errors.New("identity not found in context") )
Functions ¶
func CtxIdentity ¶
CtxIdentity returns identity from context
func CtxPeerClientVersion ¶ added in v0.2.2
CtxPeerClientVersion returns peer client version
func CtxPeerId ¶
CtxPeerId first tries to get peer id under our own key, but if it is not found tries to get through DRPC key
func CtxWithClientVersion ¶ added in v0.2.2
CtxWithClientVersion sets peer clientVersion to the context
func CtxWithIdentity ¶
CtxWithIdentity sets identity in the context
func CtxWithPeerAddr ¶
CtxWithPeerAddr sets peer address to the context
Types ¶
type Peer ¶
type Peer interface { Id() string Context() context.Context AcquireDrpcConn(ctx context.Context) (drpc.Conn, error) ReleaseDrpcConn(conn drpc.Conn) DoDrpc(ctx context.Context, do func(conn drpc.Conn) error) error IsClosed() bool CloseChan() <-chan struct{} // SetTTL overrides the default pool ttl SetTTL(ttl time.Duration) TryClose(objectTTL time.Duration) (res bool, err error) ocache.Object }
Click to show internal directories.
Click to hide internal directories.