ipfs-cluster: github.com/ipfs/ipfs-cluster/rpcutil Index | Files | Directories

package rpcutil

import "github.com/ipfs/ipfs-cluster/rpcutil"

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

Index

Package Files

rpcutil.go

func CheckErrs Uses

func CheckErrs(errs []error) error

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 Uses

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 Uses

func CopyIDSliceToIfaces(in [][]*api.ID) []interface{}

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 Uses

func CopyIDsToIfaces(in []*api.ID) []interface{}

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 CopyPIDsToIfaces Uses

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 CopyPinInfoSliceToIfaces Uses

func CopyPinInfoSliceToIfaces(in [][]*api.PinInfo) []interface{}

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 Uses

func CopyPinInfoToIfaces(in []*api.PinInfo) []interface{}

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 CopyRepoGCSliceToIfaces Uses

func CopyRepoGCSliceToIfaces(in []*api.RepoGC) []interface{}

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 Uses

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

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

func CtxsWithTimeout Uses

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 Uses

func MultiCancel(cancels []context.CancelFunc)

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

func RPCDiscardReplies Uses

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).

Directories

PathSynopsis
policygen

Package rpcutil imports 6 packages (graph) and is imported by 3 packages. Updated 2020-06-07. Refresh now. Tools for package owners.