rpcutil

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package rpcutil provides utility methods to perform go-libp2p-gorpc calls, particularly gorpc.MultiCall().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyEmptyStructToIfaces

func CopyEmptyStructToIfaces(in []struct{}) []interface{}

CopyEmptyStructToIfaces converts an empty struct slice to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.

func CopyIDSerialSliceToIfaces

func CopyIDSerialSliceToIfaces(in [][]api.IDSerial) []interface{}

CopyIDSerialSliceToIfaces converts an api.IDSerial slice of slices to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.

func CopyIDSerialsToIfaces

func CopyIDSerialsToIfaces(in []api.IDSerial) []interface{}

CopyIDSerialsToIfaces converts an api.IDSerial slice to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.

func CopyPIDsToIfaces

func CopyPIDsToIfaces(in []peer.ID) []interface{}

CopyPIDsToIfaces converts a peer.ID slice to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.

func CopyPinInfoSerialSliceToIfaces

func CopyPinInfoSerialSliceToIfaces(in [][]api.PinInfoSerial) []interface{}

CopyPinInfoSerialSliceToIfaces converts an api.PinInfoSerial slice of slices to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.

func CopyPinInfoSerialToIfaces

func CopyPinInfoSerialToIfaces(in []api.PinInfoSerial) []interface{}

CopyPinInfoSerialToIfaces converts an api.PinInfoSerial slice to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.

func CtxsWithCancel

func CtxsWithCancel(
	parent context.Context,
	n int,
) ([]context.Context, []context.CancelFunc)

CtxsWithCancel returns n cancellable contexts, derived from the given parent.

func CtxsWithTimeout

func CtxsWithTimeout(
	parent context.Context,
	n int,
	timeout time.Duration,
) ([]context.Context, []context.CancelFunc)

CtxsWithTimeout returns n contexts, derived from the given parent using the given timeout.

func MultiCancel

func MultiCancel(cancels []context.CancelFunc)

MultiCancel calls all the provided CancelFuncs. It is useful with "defer Multicancel()"

func RPCDiscardReplies

func RPCDiscardReplies(n int) []interface{}

RPCDiscardReplies returns a []interface{} slice made from a []struct{} slice of then given length. Useful for RPC methods which have no response types (so they use empty structs).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL