core

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0, MIT Imports: 46 Imported by: 1

Documentation

Index

Constants

View Source
const BufSize = (4 << 20) / 128 * 127

Variables

This section is empty.

Functions

func ConfigureModels

func ConfigureModels(db *gorm.DB)

func GetHostname

func GetHostname() string

func GetPublicIP

func GetPublicIP() (string, error)

func OpenDatabase

func OpenDatabase(cfg config.DeltaConfig) (*gorm.DB, error)

func ScanHostComputeResources

func ScanHostComputeResources(ln *LightNode, repo string) error

Types

type CarHeader added in v1.0.2

type CarHeader struct {
	Roots   []cid.Cid
	Version uint64
}

type CarParam added in v1.0.2

type CarParam struct {
	SourceInput    string
	SplitSizeInput string
	OutDir         string
	IncludeCommp   bool
}

type CommpResult added in v1.0.2

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

type Content

type Content struct {
	ID               int64     `gorm:"primaryKey"`
	Name             string    `json:"name"`
	Size             int64     `json:"size"`
	Cid              string    `json:"cid"`
	RequestingApiKey string    `json:"requesting_api_key,omitempty"`
	DeltaContentId   int64     `json:"delta_content_id"`
	DeltaNodeUrl     string    `json:"delta_node_url"`
	Status           string    `json:"status"`
	LastMessage      string    `json:"last_message"`
	Miner            string    `json:"miner"`
	Replication      int       `json:"replication"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

main content record

type ContentCarSplit

type ContentCarSplit struct {
	ID        int64 `gorm:"primaryKey"`
	ContentID int64 `json:"content_id"`
}

type ContentDeal

type ContentDeal struct {
	ID                  int64     `gorm:"primaryKey"`
	CreatedAt           time.Time `json:"CreatedAt"`
	UpdatedAt           time.Time `json:"UpdatedAt"`
	DeletedAt           time.Time `json:"DeletedAt"`
	ContentId           int64     `json:"delta_content_id"`
	UserID              int       `json:"user_id"`
	PropCid             string    `json:"propCid"`
	DealUUID            string    `json:"dealUuid"`
	Miner               string    `json:"miner"`
	Status              string    `json:"status"`
	Failed              bool      `json:"failed"`
	Verified            bool      `json:"verified"`
	Slashed             bool      `json:"slashed"`
	FailedAt            time.Time `json:"failedAt"`
	DtChan              string    `json:"dtChan"`
	TransferStarted     time.Time `json:"transferStarted"`
	TransferFinished    time.Time `json:"transferFinished"`
	OnChainAt           time.Time `json:"onChainAt"`
	SealedAt            time.Time `json:"sealedAt"`
	DealProtocolVersion string    `json:"deal_protocol_version"`
	MinerVersion        string    `json:"miner_version"`
}

type ContentReplication

type ContentReplication struct {
	ID                    int64     `gorm:"primaryKey"`
	PrimaryContentID      int64     `json:"primary_content_id"`
	PrimaryDeltaContentID int64     `json:"primary_delta_content_id"`
	ReplicaContentID      int64     `json:"replica_content_id"`
	ReplicaDeltaContentID int64     `json:"replica_delta_content_id"`
	CreatedAt             time.Time `json:"CreatedAt"`
	UpdatedAt             time.Time `json:"UpdatedAt"`
}

type FileSplitter

type FileSplitter struct {
	SplitterParam
}

func NewFileSplitter

func NewFileSplitter(param SplitterParam) FileSplitter

func (FileSplitter) SplitFile

func (c FileSplitter) SplitFile(filePath string) ([][]byte, error)

func (FileSplitter) SplitFileFromReader

func (c FileSplitter) SplitFileFromReader(fileFromReader io.Reader) ([][]byte, error)

func (FileSplitter) SplitFileFromReaderIntoBlockstore

func (c FileSplitter) SplitFileFromReaderIntoBlockstore(fileFromReader io.Reader) ([]SplitChunk, error)

type GatewayHandler

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

func NewGatewayHandler

func NewGatewayHandler(node *whypfs.Node) (*GatewayHandler, error)

type Input added in v1.0.2

type Input []utils.Finfo

type LightNode

type LightNode struct {
	Node   *whypfs.Node
	Api    url.URL
	DB     *gorm.DB
	Gw     *GatewayHandler
	Config *config.DeltaConfig
}

func NewEdgeNode

func NewEdgeNode(ctx context.Context, cfg config.DeltaConfig) (*LightNode, error)

NewEdgeNode Add a config to enable gateway or not. Add a config to enable content, bucket, commp, replication verifier processor

func (*LightNode) ConnectToDelegates

func (ln *LightNode) ConnectToDelegates(ctx context.Context, delegates []string) error

func (*LightNode) GetLocalhostOrigins

func (ln *LightNode) GetLocalhostOrigins() []string

type LocalWallet

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

type PieceCommitment added in v1.0.2

type PieceCommitment struct {
	PieceCID          string `json:"piece_cid"`
	PaddedPieceSize   uint64 `json:"padded_piece_size"`
	UnpaddedPieceSize uint64 `json:"unpadded_piece_size"`
}

type Result added in v1.0.2

type Result struct {
	PayloadCid      string                       `json:"cid"`
	PieceCommitment PieceCommitment              `json:"piece_commitment"`
	Size            uint64                       `json:"size"`
	Miner           string                       `json:"miner"`
	CidMap          map[string]utils.CidMapValue `json:"cid_map"`
}

func ChunkFileToCar added in v1.0.2

func ChunkFileToCar(carParam CarParam) (Result, error)

type SplitChunk

type SplitChunk struct {
	Cid   string
	Chunk []byte `json:"Chunk,omitempty"`
	Size  int
	Index int
}

type SplitReassembler

type SplitReassembler struct {
	SplitReassemblerParam
}

func NewSplitReassembler

func NewSplitReassembler(param SplitReassemblerParam) SplitReassembler

func (SplitReassembler) ReassembleFileFromCid

func (c SplitReassembler) ReassembleFileFromCid(cidStr string) (*os.File, error)

cid of the splitupload file

type SplitReassemblerParam

type SplitReassemblerParam struct {
	LightNode *LightNode
}

type SplitterParam

type SplitterParam struct {
	ChuckSize int64
	LightNode *LightNode
}

type UploadSplits

type UploadSplits struct {
	Cid       string `json:"cid"`
	Index     int    `json:"index"`
	ContentId int64  `json:"contentId"`
}

Jump to

Keyboard shortcuts

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