Documentation
¶
Overview ¶
Package rpcutil provides utility methods to perform go-libp2p-gorpc calls, particularly gorpc.MultiCall().
Index ¶
- func CheckErrs(errs []error) error
- func CopyEmptyStructToIfaces(in []struct{}) []interface{}
- func CopyIDSliceToIfaces(in [][]api.ID) []interface{}
- func CopyIDsToIfaces(in []api.ID) []interface{}
- func CopyIpfsIDToIfaces(in []api.IPFSID) []interface{}
- func CopyPinInfoSliceToIfaces(in [][]api.PinInfo) []interface{}
- func CopyPinInfoToIfaces(in []api.PinInfo) []interface{}
- func CopyPinRespToIfaces(in []api.PinResp) []interface{}
- func CopyRepoGCSliceToIfaces(in []api.RepoGC) []interface{}
- func CtxsWithCancel(parent context.Context, n int) ([]context.Context, []context.CancelFunc)
- func CtxsWithTimeout(parent context.Context, n int, timeout time.Duration) ([]context.Context, []context.CancelFunc)
- func MultiCancel(cancels []context.CancelFunc)
- func RPCDiscardReplies(n int) []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckErrs ¶
CheckErrs returns nil if all the errors in a slice are nil, otherwise it returns a single error formed by joining the error messages existing in the slice with a line-break.
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 CopyIDSliceToIfaces ¶
CopyIDSliceToIfaces converts an api.ID slice of slices to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.
func CopyIDsToIfaces ¶
CopyIDsToIfaces converts an api.ID slice to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.
func CopyIpfsIDToIfaces ¶
func CopyPinInfoSliceToIfaces ¶
CopyPinInfoSliceToIfaces converts an api.PinInfo slice of slices to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.
func CopyPinInfoToIfaces ¶
CopyPinInfoToIfaces converts an api.PinInfo slice to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.
func CopyPinRespToIfaces ¶
func CopyRepoGCSliceToIfaces ¶
CopyRepoGCSliceToIfaces converts an api.RepoGC slice to an empty interface slice using pointers to each elements of the original slice. Useful to handle gorpc.MultiCall() replies.
func CtxsWithCancel ¶
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.