contentmgr

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0, MIT Imports: 60 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEAL_CHECK_UNKNOWN = iota
	DEAL_CHECK_PROGRESS
	DEAL_CHECK_DEALID_ON_CHAIN
	DEAL_CHECK_SECTOR_ON_CHAIN
	DEAL_NEARLY_EXPIRED
	DEAL_CHECK_SLASHED
)

Variables

View Source
var ErrNilParams = fmt.Errorf("shuttle message had nil params")
View Source
var ErrNoShuttleConnection = fmt.Errorf("no connection to requested shuttle")
View Source
var ErrNotOnChainYet = fmt.Errorf("message not found on chain")
View Source
var ErrWaitForRemoteCompute = fmt.Errorf("waiting for remote commP computation")

Functions

This section is empty.

Types

type ContentManager

type ContentManager struct {
	ShuttlesLk sync.Mutex
	Shuttles   map[string]*ShuttleConnection

	IncomingRPCMessages chan *drpc.Message

	// TODO move out to filc package
	TcLk             sync.Mutex
	TrackingChannels map[string]*util.ChanTrack
	// contains filtered or unexported fields
}

func NewContentManager

func NewContentManager(db *gorm.DB, api api.Gateway, fc *filclient.FilClient, tbs *util.TrackingBlockstore, nd *node.Node, cfg *config.Estuary, minerManager miner.IMinerManager, log *zap.SugaredLogger) (*ContentManager, error)

func (*ContentManager) AddDatabaseTracking

func (cm *ContentManager) AddDatabaseTracking(ctx context.Context, u *util.User, dserv ipld.NodeGetter, root cid.Cid, filename string, replication int) (*util.Content, error)

func (*ContentManager) AddDatabaseTrackingToContent

func (cm *ContentManager) AddDatabaseTrackingToContent(ctx context.Context, cont uint, dserv ipld.NodeGetter, root cid.Cid, cb func(int64)) error

func (*ContentManager) AggregateStagingZone

func (cm *ContentManager) AggregateStagingZone(ctx context.Context, zone util.Content, loc string) error

AggregateStagingZone assumes zone is already in consolidatingZones

func (*ContentManager) ClearUnused

func (cm *ContentManager) ClearUnused(ctx context.Context, spaceRequest int64, loc string, users []uint, dryrun bool) (*collectionResult, error)

func (*ContentManager) CreateAggregate

func (cm *ContentManager) CreateAggregate(ctx context.Context, conts []util.Content) (ipld.Node, error)

func (*ContentManager) DealMakingDisabled

func (cm *ContentManager) DealMakingDisabled() bool

func (*ContentManager) DoPinning added in v0.2.3

func (*ContentManager) GarbageCollect

func (cm *ContentManager) GarbageCollect(ctx context.Context) error

func (*ContentManager) GetContent

func (cm *ContentManager) GetContent(id uint) (*util.Content, error)

func (*ContentManager) GetPieceCommitment

func (cm *ContentManager) GetPieceCommitment(ctx context.Context, data cid.Cid, bs blockstore.Blockstore) (cid.Cid, uint64, abi.UnpaddedPieceSize, error)

func (*ContentManager) GetPinOperation added in v0.2.3

func (cm *ContentManager) GetPinOperation(cont util.Content, peers []*peer.AddrInfo, replaceID uint, makeDeal bool) *operation.PinningOperation

func (*ContentManager) GetProviderDealStatus

func (cm *ContentManager) GetProviderDealStatus(ctx context.Context, d *model.ContentDeal, maddr address.Address, dealUUID *uuid.UUID) (*storagemarket.ProviderDealState, bool, error)

first check deal protocol version 2, then check version 1

func (*ContentManager) GetRemovalCandidates

func (cm *ContentManager) GetRemovalCandidates(ctx context.Context, all bool, loc string, users []uint) ([]removalCandidateInfo, error)

func (*ContentManager) GetStagingZoneSnapshot

func (cm *ContentManager) GetStagingZoneSnapshot(ctx context.Context) map[uint][]*ContentStagingZone

func (*ContentManager) GetStagingZonesForUser

func (cm *ContentManager) GetStagingZonesForUser(ctx context.Context, user uint) []*ContentStagingZone

func (*ContentManager) GetTransferStatus

func (cm *ContentManager) GetTransferStatus(ctx context.Context, d *model.ContentDeal, contCID cid.Cid, contLoc string) (*filclient.ChannelState, error)

func (*ContentManager) HandleRpcTransferStatus

func (cm *ContentManager) HandleRpcTransferStatus(ctx context.Context, handle string, param *drpc.TransferStatus) error

func (*ContentManager) HandleSanityCheck

func (cm *ContentManager) HandleSanityCheck(cc cid.Cid, errMsg string)

func (*ContentManager) HandleShuttleMessages

func (cm *ContentManager) HandleShuttleMessages(ctx context.Context, numHandlers int)

func (*ContentManager) IsZoneAggregating added in v0.2.1

func (cm *ContentManager) IsZoneAggregating(zoneID uint) bool

func (*ContentManager) IsZoneConsolidating added in v0.2.1

func (cm *ContentManager) IsZoneConsolidating(zoneID uint) bool

func (*ContentManager) MakeDealWithMiner

func (cm *ContentManager) MakeDealWithMiner(ctx context.Context, content util.Content, miner address.Address) (uint, error)

func (*ContentManager) MarkFinishedAggregating added in v0.2.1

func (cm *ContentManager) MarkFinishedAggregating(zoneID uint)

func (*ContentManager) MarkFinishedConsolidating added in v0.2.1

func (cm *ContentManager) MarkFinishedConsolidating(zoneID uint)

func (*ContentManager) MarkStartedAggregating added in v0.2.1

func (cm *ContentManager) MarkStartedAggregating(zoneID uint) bool

func (*ContentManager) MarkStartedConsolidating added in v0.2.1

func (cm *ContentManager) MarkStartedConsolidating(zoneID uint) bool

func (*ContentManager) OffloadContents

func (cm *ContentManager) OffloadContents(ctx context.Context, conts []uint) (int, error)

func (*ContentManager) PinContent

func (cm *ContentManager) PinContent(ctx context.Context, user uint, obj cid.Cid, filename string, cols []*collections.CollectionRef, origins []*peer.AddrInfo, replaceID uint, meta map[string]interface{}, makeDeal bool) (*types.IpfsPinStatusResponse, *operation.PinningOperation, error)

func (*ContentManager) PinContentOnShuttle added in v0.2.3

func (cm *ContentManager) PinContentOnShuttle(ctx context.Context, cont util.Content, peers []*peer.AddrInfo, replaceID uint, handle string, makeDeal bool) error

func (*ContentManager) PinDelegatesForContent

func (cm *ContentManager) PinDelegatesForContent(cont util.Content) []string

func (*ContentManager) PinStatus

func (cm *ContentManager) PinStatus(cont util.Content, origins []*peer.AddrInfo) (*types.IpfsPinStatusResponse, error)

func (*ContentManager) PinStatusFunc added in v0.2.3

func (cm *ContentManager) PinStatusFunc(contID uint, location string, status types.PinningStatus) error

func (*ContentManager) RecordRetrievalFailure

func (cm *ContentManager) RecordRetrievalFailure(rfr *util.RetrievalFailureRecord) error

func (*ContentManager) RecordRetrievalSuccess

func (cm *ContentManager) RecordRetrievalSuccess(cc cid.Cid, m address.Address, rstats *filclient.RetrievalStats)

func (*ContentManager) RefreshContent

func (cm *ContentManager) RefreshContent(ctx context.Context, cont uint) error

func (*ContentManager) RefreshContentForCid

func (cm *ContentManager) RefreshContentForCid(ctx context.Context, c cid.Cid) (blocks.Block, error)

func (*ContentManager) RegisterShuttleConnection

func (cm *ContentManager) RegisterShuttleConnection(handle string, hello *drpc.Hello) (chan *drpc.Command, func(), error)

func (*ContentManager) RemoveContent

func (cm *ContentManager) RemoveContent(ctx context.Context, contID uint, now bool) error

func (*ContentManager) RestartAllTransfersForLocation added in v0.2.3

func (cm *ContentManager) RestartAllTransfersForLocation(ctx context.Context, loc string) error

func (*ContentManager) RestartTransfer

func (cm *ContentManager) RestartTransfer(ctx context.Context, loc string, chanid datatransfer.ChannelID, d model.ContentDeal) error

RestartTransfer tries to resume incomplete data transfers between client and storage providers. It supports only legacy deals (PushTransfer)

func (*ContentManager) Run

func (cm *ContentManager) Run(ctx context.Context)

func (*ContentManager) SendAggregateCmd

func (cm *ContentManager) SendAggregateCmd(ctx context.Context, loc string, cont util.Content, aggr []drpc.AggregateContent) error

func (*ContentManager) SendConsolidateContentCmd

func (cm *ContentManager) SendConsolidateContentCmd(ctx context.Context, loc string, contents []util.Content) error

func (*ContentManager) SendShuttleCommand

func (cm *ContentManager) SendShuttleCommand(ctx context.Context, handle string, cmd *drpc.Command) error

func (*ContentManager) SetDataTransferStartedOrFinished

func (cm *ContentManager) SetDataTransferStartedOrFinished(ctx context.Context, dealDBID uint, chanIDOrTransferID string, st *filclient.ChannelState, isStarted bool) error

func (*ContentManager) SetDealMakingEnabled

func (cm *ContentManager) SetDealMakingEnabled(enable bool)

func (*ContentManager) ShuttleAddrInfo

func (cm *ContentManager) ShuttleAddrInfo(handle string) *peer.AddrInfo

func (*ContentManager) ShuttleCanAddContent

func (cm *ContentManager) ShuttleCanAddContent(handle string) bool

func (*ContentManager) ShuttleHostName

func (cm *ContentManager) ShuttleHostName(handle string) string

func (*ContentManager) ShuttleIsOnline

func (cm *ContentManager) ShuttleIsOnline(handle string) bool

func (*ContentManager) ShuttleStorageStats

func (cm *ContentManager) ShuttleStorageStats(handle string) *util.ShuttleStorageStats

func (*ContentManager) StartDataTransfer

func (cm *ContentManager) StartDataTransfer(ctx context.Context, cd *model.ContentDeal) error

func (*ContentManager) ToCheck

func (cm *ContentManager) ToCheck(contID uint)

func (*ContentManager) TrackTransfer added in v0.2.3

func (cm *ContentManager) TrackTransfer(chanid *datatransfer.ChannelID, dealdbid uint, st *filclient.ChannelState)

TODO move out to filc package

func (*ContentManager) TryRetrieve

func (cm *ContentManager) TryRetrieve(ctx context.Context, maddr address.Address, c cid.Cid, ask *retrievalmarket.QueryResponse) error

func (*ContentManager) UnpinContent

func (cm *ContentManager) UnpinContent(ctx context.Context, contid uint) error

func (*ContentManager) UpdatePinStatus

func (cm *ContentManager) UpdatePinStatus(location string, contID uint, status types.PinningStatus) error

even though there are 4 pin statuses, queued, pinning, pinned and failed the UpdatePinStatus only changes DB state for failed status when the content was added, status = pinning when the pin process is complete, status = pinned

type ContentStagingZone

type ContentStagingZone struct {
	ZoneOpened      time.Time      `json:"zoneOpened"`
	Contents        []util.Content `json:"contents"`
	MinSize         int64          `json:"minSize"`
	MaxSize         int64          `json:"maxSize"`
	CurSize         int64          `json:"curSize"`
	User            uint           `json:"user"`
	ContID          uint           `json:"contentID"`
	Location        string         `json:"location"`
	IsConsolidating bool           `json:"isConsolidating"`
	// contains filtered or unexported fields
}

type DealFailureError

type DealFailureError struct {
	Miner               address.Address
	DealUUID            string
	Phase               string
	Message             string
	Content             uint
	UserID              uint
	MinerAddress        string
	DealProtocolVersion protocol.ID
	MinerVersion        string
}

func (*DealFailureError) Error

func (dfe *DealFailureError) Error() string

func (*DealFailureError) Record

func (dfe *DealFailureError) Record() *model.DfeRecord

type ShuttleConnection

type ShuttleConnection struct {
	Handle string

	Hostname string

	ContentAddingDisabled bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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