modules

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServerIDName Server ID key name in the keystore
	ServerIDName = "server-id" //nolint:gosec
	// KTServerIDSecret Key type for server ID secret
	KTServerIDSecret = "server-id-secret" //nolint:gosec
	// PrivateKeyName privateKey key name in the keystore
	PrivateKeyName = "private-key" //nolint:gosec
)

Variables

This section is empty.

Functions

func CheckFdLimit

func CheckFdLimit() error

CheckFdLimit checks the file descriptor limit and returns an error if the limit is too low

func Datastore

func Datastore(db *db.SQLDB, serverID dtypes.ServerID) (dtypes.MetadataDS, error)

Datastore returns a new metadata datastore

func GenerateTokenWithWebPermission added in v0.1.10

func GenerateTokenWithWebPermission(ca *common.CommonAPI) (dtypes.PermissionWebToken, error)

GenerateTokenWithWebPermission create a new token based on the given permissions

func LockedRepo

func LockedRepo(lr repo.LockedRepo) func(lc fx.Lifecycle) repo.LockedRepo

LockedRepo returns a function that returns the locked repository with an added lifecycle hook to close the repository

func NewAssetsManager

func NewAssetsManager(pullParallel int, pullTimeout int, pullRetry int, ipfsAPIURL string) func(storageMgr *storage.Manager, schedulerAPI api.Scheduler) (*asset.Manager, error)

NewAssetsManager creates a function that generates new instances of asset.Manager.

func NewDB

func NewDB(cfg *config.SchedulerCfg) (*sqlx.DB, error)

NewDB returns an *sqlx.DB instance

func NewDataSync

func NewDataSync(assetMgr *asset.Manager) *datasync.DataSync

NewDataSync creates a new instance of datasync.DataSync with the given asset.Manager.

func NewDevice

func NewDevice(cpu *config.CPU, memory *config.Memory, storageCfg *config.Storage, bandwidth *config.Bandwidth) func(nodeID dtypes.NodeID, internalIP dtypes.InternalIP, storageMgr *storage.Manager) *device.Device

NewDevice creates a function that generates new instances of device.Device.

func NewGetSchedulerConfigFunc

func NewGetSchedulerConfigFunc(r repo.LockedRepo) func() (config.SchedulerCfg, error)

NewGetSchedulerConfigFunc creates a function to get the scheduler config

func NewLocatorStorage

func NewLocatorStorage(addresses dtypes.EtcdAddresses) (locator.Storage, error)

NewLocatorStorage creates a locator storage using the give addresses

func NewNodeStorageManager

func NewNodeStorageManager(metadataPaths dtypes.NodeMetadataPath, assetsPaths dtypes.AssetsPaths, minioConfig *config.MinioConfig, schedulerAPI api.Scheduler) (*storage.Manager, error)

NewNodeStorageManager creates a new instance of storage.Manager with the given carfile store path.

func NewNodeValidation

func NewNodeValidation(assetMgr *asset.Manager, device *device.Device) *validation.Validation

NewNodeValidation creates a new instance of validation.Validation with the given asset.Manager and device.Device.

func NewPrivateKey added in v0.1.11

func NewPrivateKey(lr repo.LockedRepo) (*rsa.PrivateKey, error)

NewPrivateKey generates and returns the private key

func NewPubSub

func NewPubSub() *pubsub.PubSub

NewPubSub returns a new pubsub instance with a buffer of 50

func NewRateLimiter

func NewRateLimiter(device *device.Device) *rate.Limiter

NewRateLimiter creates a new rate limiter based on the given device's bandwidth limits.

func NewRegion

func NewRegion(dbPath dtypes.GeoDBPath) (region.Region, error)

NewRegion creates a new region instance using the given database path.

func NewSchedulerAPIMap added in v0.1.14

func NewSchedulerAPIMap() (locator.SchedulerAPIMap, error)

func NewServerID

func NewServerID(lr repo.LockedRepo) (dtypes.ServerID, error)

NewServerID generates and returns the server ID

func NewSetSchedulerConfigFunc

func NewSetSchedulerConfigFunc(r repo.LockedRepo) func(config.SchedulerCfg) error

NewSetSchedulerConfigFunc creates a function to set the scheduler config

func NewStorageManager

func NewStorageManager(params StorageManagerParams) *assets.Manager

NewStorageManager creates a new storage manager instance

func NewTCPServer

func NewTCPServer(lc fx.Lifecycle, cfg *config.CandidateCfg, schedulerAPI api.Scheduler, key *rsa.PrivateKey) *candidate.TCPServer

NewTCPServer returns a new TCP server instance.

func NewValidation

NewValidation creates a new validation manager instance

func RegisterToEtcd

func RegisterToEtcd(mctx helpers.MetricsCtx, lc fx.Lifecycle, configFunc dtypes.GetSchedulerConfigFunc, serverID dtypes.ServerID, token dtypes.PermissionWebToken) (*etcdcli.Client, error)

RegisterToEtcd registers the server to etcd

Types

type StorageManagerParams

type StorageManagerParams struct {
	fx.In

	Lifecycle  fx.Lifecycle
	MetricsCtx helpers.MetricsCtx
	MetadataDS dtypes.MetadataDS
	NodeManger *node.Manager
	dtypes.GetSchedulerConfigFunc
	*db.SQLDB
}

StorageManagerParams Manager Params

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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