util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed identity.cert
	Certificate []byte

	//go:embed identity.key
	Key []byte
)

Functions

func DownloadPiece

func DownloadPiece(ctx context.Context, client pb.DRPCReplaySafePiecestoreClient, creator *KeySigner, req DownloadRequest, handler func(data []byte, hash *pb.PieceHash, limit *pb.OrderLimit)) (downloaded int64, chunks int, err error)

func ForEachNodeCSV

func ForEachNodeCSV(file string, cb func(node storj.NodeURL) error) error

func GetDialer

func GetDialer(ctx context.Context, pooled bool, forceQuic bool) (rpc.Dialer, error)

func GetDialerForIdentity

func GetDialerForIdentity(ctx context.Context, ident *identity.FullIdentity, pooled bool, forceQuic bool) (rpc.Dialer, error)

func Measure

func Measure(f func() error) (time.Duration, error)

func NewTracedConnection

func NewTracedConnection(conn drpc.Conn) drpc.Conn

func ParseSegmentPosition

func ParseSegmentPosition(i string) (uuid.UUID, metabase.SegmentPosition, error)

ParseSegmentPosition parse segment position from segment/pos format

func ParseUUID

func ParseUUID(id string) (uuid.UUID, error)

func PrintHistogram

func PrintHistogram(nodes []*nodeselection.SelectedNode, selector nodeselection.NodeAttribute)

func RunLoop

func RunLoop(n int, verbose bool, do func() error) (durationMs int64, err error)

Types

type Dialer

type Dialer func(ctx context.Context, nodeURL storj.NodeURL) (_ *rpc.Conn, err error)

type DialerHelper

type DialerHelper struct {
	Quic        bool
	Pooled      bool
	Noise       bool
	IdentityDir string `default:"."`
}

func NewDialerHelper

func NewDialerHelper(flagSet *flag.FlagSet) *DialerHelper

func (*DialerHelper) Connect

func (d *DialerHelper) Connect(ctx context.Context, nodeURL storj.NodeURL) (*rpc.Conn, error)

func (*DialerHelper) CreateDialer

func (d *DialerHelper) CreateDialer() (Dialer, error)

func (*DialerHelper) CreateRPCDialer

func (d *DialerHelper) CreateRPCDialer() (rpc.Dialer, error)

type DownloadRequest

type DownloadRequest struct {
	SatelliteID storj.NodeID
	PieceID     storj.PieceID
	Storagenode storj.NodeURL
	Size        int64
}

type KeySigner

type KeySigner struct {
	Action pb.PieceAction
	TTL    time.Duration
	// contains filtered or unexported fields
}

func NewKeySigner

func NewKeySigner() (*KeySigner, error)

func NewKeySignerFromDir

func NewKeySignerFromDir(keysDir string) (*KeySigner, error)

func NewKeySignerFromFullIdentity

func NewKeySignerFromFullIdentity(id *identity.FullIdentity, action pb.PieceAction) *KeySigner

func (*KeySigner) CreateOrderLimit

func (d *KeySigner) CreateOrderLimit(ctx context.Context, pieceID storj.PieceID, size int64, sn storj.NodeID) (limit *pb.OrderLimit, pk storj.PiecePrivateKey, serial storj.SerialNumber, err error)

func (*KeySigner) GetSatelliteID

func (d *KeySigner) GetSatelliteID() storj.NodeID

type Loop

type Loop struct {
	Verbose bool `short:"v" help:"Print out more information"`
	Sample  int  `short:"n"  default:"1" help:"Number of executions"`
}

func (*Loop) Run

func (l *Loop) Run(do func() error) (durationMs int64, err error)

type OrderLimitCreator

type OrderLimitCreator interface {
	CreateOrderLimit(ctx context.Context, pieceID storj.PieceID, size int64, satellite storj.NodeID, sn storj.NodeID) (limit *pb.OrderLimit, pk storj.PiecePrivateKey, serial storj.SerialNumber, err error)
}

type Progres

type Progres struct {
	// contains filtered or unexported fields
}

func (*Progres) Counter

func (o *Progres) Counter() int64

func (*Progres) Increment

func (o *Progres) Increment()

type TracedConnection

type TracedConnection struct {
	Conn drpc.Conn
}

func (*TracedConnection) Close

func (t *TracedConnection) Close() error

func (*TracedConnection) Closed

func (t *TracedConnection) Closed() <-chan struct{}

func (*TracedConnection) Invoke

func (t *TracedConnection) Invoke(ctx context.Context, rpc string, enc drpc.Encoding, in, out drpc.Message) (err error)

func (*TracedConnection) NewStream

func (t *TracedConnection) NewStream(ctx context.Context, rpc string, enc drpc.Encoding) (drpc.Stream, error)

type TracedStream

type TracedStream struct {
	// contains filtered or unexported fields
}

func (*TracedStream) Close

func (t *TracedStream) Close() error

func (*TracedStream) CloseSend

func (t *TracedStream) CloseSend() error

func (*TracedStream) Context

func (t *TracedStream) Context() context.Context

func (*TracedStream) MsgRecv

func (t *TracedStream) MsgRecv(msg drpc.Message, enc drpc.Encoding) (err error)

func (*TracedStream) MsgSend

func (t *TracedStream) MsgSend(msg drpc.Message, enc drpc.Encoding) (err error)

type WithKeySigner

type WithKeySigner struct {
	SignerIdentity string        `usage:"the identity directory for signing order limits"`
	TTL            time.Duration `usage:"piece expiration period of orders"`
	// contains filtered or unexported fields
}

func (*WithKeySigner) CreateOrderLimit

func (w *WithKeySigner) CreateOrderLimit(ctx context.Context, pieceID storj.PieceID, size int64, sn storj.NodeID) (limit *pb.OrderLimit, pk storj.PiecePrivateKey, serial storj.SerialNumber, err error)

func (*WithKeySigner) Init

func (w *WithKeySigner) Init(action pb.PieceAction) (err error)

Jump to

Keyboard shortcuts

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