Documentation ¶
Overview ¶
Package testplanet implements the full network wiring for testing
Index ¶
- Variables
- func Run(t *testing.T, config Config, ...)
- type Config
- type Peer
- type Planet
- func New(t zaptest.TestingT, satelliteCount, storageNodeCount, uplinkCount int) (*Planet, error)
- func NewCustom(log *zap.Logger, config Config) (*Planet, error)
- func NewWithIdentityVersion(t zaptest.TestingT, identityVersion *storj.IDVersion, ...) (*Planet, error)
- func NewWithLogger(log *zap.Logger, satelliteCount, storageNodeCount, uplinkCount int) (*Planet, error)
- func (planet *Planet) Identities() *testidentity.Identities
- func (planet *Planet) NewIdentity() (*identity.FullIdentity, error)
- func (planet *Planet) NewListener() (net.Listener, error)
- func (planet *Planet) NewVersionConfig() version.Config
- func (planet *Planet) NewVersionInfo() version.Info
- func (planet *Planet) Shutdown() error
- func (planet *Planet) Size() int
- func (planet *Planet) Start(ctx context.Context)
- func (planet *Planet) StopPeer(peer Peer) error
- func (planet *Planet) WriteWhitelist(version storj.IDVersion) (string, error)
- type Reconfigure
- type SatelliteSystem
- type Uplink
- func (client *Uplink) Addr() string
- func (client *Uplink) CreateBucket(ctx context.Context, satellite *SatelliteSystem, bucketName string) error
- func (client *Uplink) Delete(ctx context.Context, satellite *SatelliteSystem, bucketName string, ...) error
- func (client *Uplink) DialMetainfo(ctx context.Context, destination Peer, apikey *macaroon.APIKey) (*metainfo.Client, error)
- func (client *Uplink) DialPiecestore(ctx context.Context, destination Peer) (*piecestore.Client, error)
- func (client *Uplink) Download(ctx context.Context, satellite *SatelliteSystem, bucketName string, ...) ([]byte, error)
- func (client *Uplink) DownloadStream(ctx context.Context, satellite *SatelliteSystem, bucketName string, ...) (_ io.ReadCloser, cleanup func() error, err error)
- func (client *Uplink) DownloadStreamRange(ctx context.Context, satellite *SatelliteSystem, bucketName string, ...) (_ io.ReadCloser, cleanup func() error, err error)
- func (client *Uplink) GetConfig(satellite *SatelliteSystem) uplink.Config
- func (client *Uplink) GetProject(ctx context.Context, satellite *SatelliteSystem) (*libuplink.Project, error)
- func (client *Uplink) GetProjectAndBucket(ctx context.Context, satellite *SatelliteSystem, bucketName string, ...) (_ *libuplink.Project, _ *libuplink.Bucket, err error)
- func (client *Uplink) ID() storj.NodeID
- func (client *Uplink) Local() pb.Node
- func (client *Uplink) NewLibuplink(ctx context.Context) (*libuplink.Uplink, error)
- func (client *Uplink) Shutdown() error
- func (client *Uplink) Upload(ctx context.Context, satellite *SatelliteSystem, bucket string, ...) error
- func (client *Uplink) UploadWithClientConfig(ctx context.Context, satellite *SatelliteSystem, clientConfig uplink.Config, ...) (err error)
- func (client *Uplink) UploadWithConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *uplink.RSConfig, ...) error
- func (client *Uplink) UploadWithExpiration(ctx context.Context, satellite *SatelliteSystem, bucket string, ...) error
- func (client *Uplink) UploadWithExpirationAndConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *uplink.RSConfig, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
var DisablePeerCAWhitelist = Reconfigure{ Satellite: func(log *zap.Logger, index int, config *satellite.Config) { config.Server.UsePeerCAWhitelist = false }, StorageNode: func(index int, config *storagenode.Config) { config.Server.UsePeerCAWhitelist = false }, }
DisablePeerCAWhitelist returns a `Reconfigure` that sets `UsePeerCAWhitelist` for all node types that use kademlia.
var ShortenOnlineWindow = Reconfigure{ Satellite: func(log *zap.Logger, index int, config *satellite.Config) { config.Overlay.Node.OnlineWindow = 1 * time.Second }, }
ShortenOnlineWindow returns a `Reconfigure` that sets the NodeSelection OnlineWindow to 1 second, meaning a connection failure leads to marking the nodes as offline
Functions ¶
Types ¶
type Config ¶
type Config struct { SatelliteCount int StorageNodeCount int UplinkCount int Identities *testidentity.Identities IdentityVersion *storj.IDVersion Reconfigure Reconfigure }
Config describes planet configuration
type Peer ¶
type Peer interface { ID() storj.NodeID Addr() string URL() storj.NodeURL Local() overlay.NodeDossier Run(context.Context) error Close() error }
Peer represents one of StorageNode or Satellite
type Planet ¶
type Planet struct { VersionControl *versioncontrol.Peer Satellites []*SatelliteSystem StorageNodes []*storagenode.Peer Uplinks []*Uplink // contains filtered or unexported fields }
Planet is a full storj system setup.
func NewWithIdentityVersion ¶ added in v0.9.0
func NewWithIdentityVersion(t zaptest.TestingT, identityVersion *storj.IDVersion, satelliteCount, storageNodeCount, uplinkCount int) (*Planet, error)
NewWithIdentityVersion creates a new full system with the given version for node identities and the given number of nodes.
func NewWithLogger ¶
func NewWithLogger(log *zap.Logger, satelliteCount, storageNodeCount, uplinkCount int) (*Planet, error)
NewWithLogger creates a new full system with the given number of nodes.
func (*Planet) Identities ¶
func (planet *Planet) Identities() *testidentity.Identities
Identities returns the identity provider for this planet.
func (*Planet) NewIdentity ¶
func (planet *Planet) NewIdentity() (*identity.FullIdentity, error)
NewIdentity creates a new identity for a node
func (*Planet) NewListener ¶
NewListener creates a new listener
func (*Planet) NewVersionConfig ¶
NewVersionConfig returns the Version Config for this planet with tuned metrics.
func (*Planet) NewVersionInfo ¶
NewVersionInfo returns the Version Info for this planet with tuned metrics.
type Reconfigure ¶
type Reconfigure struct { NewSatelliteDB func(log *zap.Logger, index int) (satellite.DB, error) Satellite func(log *zap.Logger, index int, config *satellite.Config) NewStorageNodeDB func(index int, db storagenode.DB, log *zap.Logger) (storagenode.DB, error) StorageNode func(index int, config *storagenode.Config) NewIPCount int }
Reconfigure allows to change node configurations
type SatelliteSystem ¶ added in v0.22.0
SatelliteSystem contains all the processes needed to run a full Satellite setup
type Uplink ¶
type Uplink struct { Log *zap.Logger Info pb.Node Identity *identity.FullIdentity Dialer rpc.Dialer StorageNodeCount int APIKey map[storj.NodeID]*macaroon.APIKey ProjectID map[storj.NodeID]uuid.UUID }
Uplink is a general purpose
func (*Uplink) CreateBucket ¶ added in v0.16.0
func (client *Uplink) CreateBucket(ctx context.Context, satellite *SatelliteSystem, bucketName string) error
CreateBucket creates a new bucket
func (*Uplink) Delete ¶
func (client *Uplink) Delete(ctx context.Context, satellite *SatelliteSystem, bucketName string, path storj.Path) error
Delete deletes an object at the path in a bucket
func (*Uplink) DialMetainfo ¶
func (client *Uplink) DialMetainfo(ctx context.Context, destination Peer, apikey *macaroon.APIKey) (*metainfo.Client, error)
DialMetainfo dials destination with apikey and returns metainfo Client
func (*Uplink) DialPiecestore ¶
func (client *Uplink) DialPiecestore(ctx context.Context, destination Peer) (*piecestore.Client, error)
DialPiecestore dials destination storagenode and returns a piecestore client.
func (*Uplink) Download ¶
func (client *Uplink) Download(ctx context.Context, satellite *SatelliteSystem, bucketName string, path storj.Path) ([]byte, error)
Download data from specific satellite
func (*Uplink) DownloadStream ¶
func (client *Uplink) DownloadStream(ctx context.Context, satellite *SatelliteSystem, bucketName string, path storj.Path) (_ io.ReadCloser, cleanup func() error, err error)
DownloadStream returns stream for downloading data
func (*Uplink) DownloadStreamRange ¶ added in v0.18.0
func (client *Uplink) DownloadStreamRange(ctx context.Context, satellite *SatelliteSystem, bucketName string, path storj.Path, start, limit int64) (_ io.ReadCloser, cleanup func() error, err error)
DownloadStreamRange returns stream for downloading data
func (*Uplink) GetConfig ¶
func (client *Uplink) GetConfig(satellite *SatelliteSystem) uplink.Config
GetConfig returns a default config for a given satellite.
func (*Uplink) GetProject ¶ added in v0.16.0
func (client *Uplink) GetProject(ctx context.Context, satellite *SatelliteSystem) (*libuplink.Project, error)
GetProject returns a libuplink.Project which allows interactions with a specific project
func (*Uplink) GetProjectAndBucket ¶ added in v0.16.0
func (client *Uplink) GetProjectAndBucket(ctx context.Context, satellite *SatelliteSystem, bucketName string, clientCfg uplink.Config) (_ *libuplink.Project, _ *libuplink.Bucket, err error)
GetProjectAndBucket returns a libuplink.Project and Bucket which allows interactions with a specific project and its buckets
func (*Uplink) NewLibuplink ¶ added in v0.16.0
NewLibuplink creates a libuplink.Uplink object with the testplanet Uplink config
func (*Uplink) Upload ¶
func (client *Uplink) Upload(ctx context.Context, satellite *SatelliteSystem, bucket string, path storj.Path, data []byte) error
Upload data to specific satellite
func (*Uplink) UploadWithClientConfig ¶ added in v0.20.0
func (client *Uplink) UploadWithClientConfig(ctx context.Context, satellite *SatelliteSystem, clientConfig uplink.Config, bucketName string, path storj.Path, data []byte) (err error)
UploadWithClientConfig uploads data to specific satellite with custom client configuration
func (*Uplink) UploadWithConfig ¶
func (client *Uplink) UploadWithConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *uplink.RSConfig, bucket string, path storj.Path, data []byte) error
UploadWithConfig uploads data to specific satellite with configured values
func (*Uplink) UploadWithExpiration ¶ added in v0.11.0
func (client *Uplink) UploadWithExpiration(ctx context.Context, satellite *SatelliteSystem, bucket string, path storj.Path, data []byte, expiration time.Time) error
UploadWithExpiration data to specific satellite and expiration time
func (*Uplink) UploadWithExpirationAndConfig ¶ added in v0.14.0
func (client *Uplink) UploadWithExpirationAndConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *uplink.RSConfig, bucketName string, path storj.Path, data []byte, expiration time.Time) (err error)
UploadWithExpirationAndConfig uploads data to specific satellite with configured values and expiration time