Documentation
¶
Index ¶
- Constants
- Variables
- func AppVersionMiddleware(appVersion string) echo.MiddlewareFunc
- func CalculateCarSize(data cid.Cid, objects []CarObject) (uint64, error)
- func CanRestartTransfer(st *filclient.ChannelState) bool
- func CidIsUnwalkable(c cid.Cid) bool
- func ConfigureRateLimiter(rateLimit rate.Limit) middleware.RateLimiterConfig
- func CreateDwebRetrievalURL(cid string) string
- func CreateEstuaryRetrievalURL(cid string) string
- func DirsFromPath(collectionPath string, filename string) ([]string, error)
- func DumpBlockstoreTo(ctx context.Context, tc trace.Tracer, from, to blockstore.Blockstore) error
- func EnsurePathIsLinked(dirs []string, rootNode *merkledag.ProtoNode, ds format.DAGService) (*merkledag.ProtoNode, error)
- func ErrorHandler(err error, ctx echo.Context)
- func ErrorIfContentAddingDisabled(isContentAddingDisabled bool) error
- func ExtractAuth(c echo.Context) (string, error)
- func FilterUnwalkableLinks(links []*ipld.Link) []*ipld.Link
- func FindAndProcessLargeRequests(db *gorm.DB, fc func(tx *gorm.DB, batch int) error, dest interface{}, ...) (tx *gorm.DB)
- func GetPasswordHash(password, salt string, dialector string) string
- func GetPasswordHashBase(password, salt string) string
- func GetPasswordHashBase64(password, salt string) string
- func GetTokenHash(token string) string
- func ImportFile(dserv ipld.DAGService, fi io.Reader) (ipld.Node, error)
- func IsCollectionOwner(uID, entityID uint) error
- func IsContentOwner(uID, entityID uint) error
- func JSONPayloadMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func OpenApiMiddleware(log *zap.SugaredLogger) echo.MiddlewareFunc
- func ParseDealLabel(s string) (cid.Cid, error)
- func SetupDatabase(dbval string) (*gorm.DB, error)
- func TracingMiddleware(tcr trace.Tracer) echo.MiddlewareFunc
- func TransferFailed(st *filclient.ChannelState) (bool, string)
- func TryExtractFSNode(nd ipld.Node) (*unixfs.FSNode, error)
- func WithContentLengthCheck(f func(echo.Context) error) func(echo.Context) error
- func WithMultipartFormDataChecker(next echo.HandlerFunc) echo.HandlerFunc
- type AuthToken
- type Binder
- type CarObject
- type ChanTrack
- type Content
- type ContentAddResponse
- type ContentCreateBody
- type ContentCreateResponse
- type ContentInCollection
- type ContentType
- type ContentWithPath
- type DbAddr
- type DbCID
- type GenericResponse
- type HttpError
- type HttpErrorResponse
- type InitShuttleResponse
- type InviteCode
- type ObjRef
- type Object
- type PeeringPeerAddMessage
- type PeeringPeerRemoveMessage
- type RetrievalFailureRecord
- type RetrievalProgress
- type ShuttleCreateContentBody
- type ShuttleListResponse
- type ShuttleStorageStats
- type TrackingBlockstore
- func (tbs *TrackingBlockstore) AllKeysChan(context.Context) (<-chan cid.Cid, error)
- func (tbs *TrackingBlockstore) DeleteBlock(ctx context.Context, _ cid.Cid) error
- func (tbs *TrackingBlockstore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)
- func (tbs *TrackingBlockstore) GetCounts(objects []Object) ([]int, error)
- func (tbs *TrackingBlockstore) GetSize(ctx context.Context, c cid.Cid) (int, error)
- func (tbs *TrackingBlockstore) Has(ctx context.Context, c cid.Cid) (bool, error)
- func (tbs *TrackingBlockstore) HashOnRead(hashOnRead bool)
- func (tbs *TrackingBlockstore) LastAccess(ctx context.Context, c cid.Cid) (time.Time, error)
- func (tbs *TrackingBlockstore) Put(ctx context.Context, blk blocks.Block) error
- func (tbs *TrackingBlockstore) PutMany(ctx context.Context, blks []blocks.Block) error
- func (tbs *TrackingBlockstore) SetCidReqFunc(f func(context.Context, cid.Cid) (blocks.Block, error))
- func (tbs *TrackingBlockstore) Under() blockstore.Blockstore
- type User
- type UserSettings
- type ViewerResponse
Constants ¶
View Source
const ( ERR_INVALID_TOKEN = "ERR_INVALID_TOKEN" ERR_TOKEN_EXPIRED = "ERR_TOKEN_EXPIRED" ERR_AUTH_MISSING = "ERR_AUTH_MISSING" ERR_WRONG_AUTH_FORMAT = "ERR_WRONG_AUTH_FORMAT" ERR_INVALID_AUTH = "ERR_INVALID_AUTH" ERR_AUTH_MISSING_BEARER = "ERR_AUTH_MISSING_BEARER" ERR_NOT_AUTHORIZED = "ERR_NOT_AUTHORIZED" ERR_MINER_NOT_OWNED = "ERR_MINER_NOT_OWNED" ERR_INVALID_INVITE = "ERR_INVALID_INVITE" ERR_USERNAME_TAKEN = "ERR_USERNAME_TAKEN" ERR_USER_CREATION_FAILED = "ERR_USER_CREATION_FAILED" ERR_USER_NOT_FOUND = "ERR_USER_NOT_FOUND" ERR_INVALID_PASSWORD = "ERR_INVALID_PASSWORD" ERR_INVALID_FILTER = "ERR_INVALID_FILTER" ERR_INVITE_ALREADY_USED = "ERR_INVITE_ALREADY_USED" ERR_CONTENT_ADDING_DISABLED = "ERR_CONTENT_ADDING_DISABLED" ERR_INVALID_INPUT = "ERR_INVALID_INPUT" ERR_CONTENT_SIZE_OVER_LIMIT = "ERR_CONTENT_SIZE_OVER_LIMIT" ERR_PEERING_PEERS_ADD_ERROR = "ERR_PEERING_PEERS_ADD_ERROR" ERR_PEERING_PEERS_REMOVE_ERROR = "ERR_PEERING_PEERS_REMOVE_ERROR" ERR_PEERING_PEERS_START_ERROR = "ERR_PEERING_PEERS_START_ERROR" ERR_PEERING_PEERS_STOP_ERROR = "ERR_PEERING_PEERS_STOP_ERROR" ERR_CONTENT_NOT_FOUND = "ERR_CONTENT_NOT_FOUND" ERR_RECORD_NOT_FOUND = "ERR_RECORD_NOT_FOUND" ERR_INVALID_PINNING_STATUS = "ERR_INVALID_PINNING_STATUS" ERR_INVALID_QUERY_PARAM_VALUE = "ERR_INVALID_QUERY_PARAM_VALUE" ERR_CONTENT_LENGTH_REQUIRED = "ERR_CONTENT_LENGTH_REQUIRED" ERR_UNSUPPORTED_CONTENT_TYPE = "ERR_UNSUPPORTED_CONTENT_TYPE" ERR_VALUE_REQUIRED = "ERR_VALUE_REQUIRED" ERR_INVALID_MINER_CLAIM_SIG = "ERR_INVALID_MINER_CLAIM_SIG" ERR_INVALID_MINER_SETUP = "ERR_INVALID_MINER_SETUP" ERR_INVALID_MINER_CLAIM_NO_PEER_ID = "ERR_INVALID_MINER_CLAIM_NO_PEER_ID" ERR_INVALID_MINER_CLAIM_NO_MULTI_ADDR = "ERR_INVALID_MINER_CLAIM_NO_MULTI_ADDR" ERR_INVALID_MINER_CLAIM_NO_POWER = "ERR_INVALID_MINER_CLAIM_NO_POWER" ERR_INVALID_MINER_CLAIM_POWER_BELOW_1TIB = "ERR_INVALID_MINER_CLAIM_POWER_BELOW_1TIB" ERR_INVALID_MINER_CLAIM_NO_ASK = "ERR_INVALID_MINER_CLAIM_NO_ASK" ERR_INVALID_MINER_CLAIM_ASK_VERIFIED_PRICE_IS_NOT_ZERO = "ERR_INVALID_MINER_CLAIM_ASK_VERIFIED_PRICE_IS_NOT_ZERO" ERR_INTERNAL_SERVER = "ERR_INTERNAL_SERVER" ERR_BAD_REQUEST = "ERR_BAD_REQUEST" )
#nosec G101 -- This is a false positive
View Source
const ( ERR_AUTH_MISSING_DETAILS = "no api key was specified" ERR_AUTH_MISSING_BEARER_DETAILS = "" //#nosec G101 -- This is a false positive and example API KEY /* 186-byte string literal not displayed */ ERR_INVALID_AUTH_DETAILS = "" //#nosec G101 -- This is a false positive and example API KEY /* 236-byte string literal not displayed */ )
View Source
const ( PermLevelUpload = 1 PermLevelUser = 2 PermLevelAdmin = 10 )
View Source
const DefaultBatchSize int = 100000
Variables ¶
View Source
var DefaultHashFunction = uint64(mh.SHA2_256)
View Source
var FlagLogLevel = &cli.StringFlag{ Name: "log-level", Usage: "sets the log level, defaults to INFO", Value: "INFO", Destination: &LogLevel, }
View Source
var LogLevel string
Functions ¶
func AppVersionMiddleware ¶
func AppVersionMiddleware(appVersion string) echo.MiddlewareFunc
func CalculateCarSize ¶
func CanRestartTransfer ¶ added in v0.1.9
func CanRestartTransfer(st *filclient.ChannelState) bool
func CidIsUnwalkable ¶
func CidIsUnwalkable(c cid.Cid) bool
func ConfigureRateLimiter ¶ added in v0.3.5
func ConfigureRateLimiter(rateLimit rate.Limit) middleware.RateLimiterConfig
func CreateDwebRetrievalURL ¶ added in v0.2.0
func CreateEstuaryRetrievalURL ¶ added in v0.2.0
func DirsFromPath ¶
DirsFromPath splits a path into a list of directories
func DumpBlockstoreTo ¶ added in v0.2.0
func DumpBlockstoreTo(ctx context.Context, tc trace.Tracer, from, to blockstore.Blockstore) error
func EnsurePathIsLinked ¶
func EnsurePathIsLinked(dirs []string, rootNode *merkledag.ProtoNode, ds format.DAGService) (*merkledag.ProtoNode, error)
func ErrorHandler ¶
func ErrorHandler(err error, ctx echo.Context)
func ErrorIfContentAddingDisabled ¶ added in v0.1.5
func ExtractAuth ¶
func FindAndProcessLargeRequests ¶ added in v0.2.5
func GetPasswordHash ¶ added in v0.1.8
func GetPasswordHashBase ¶ added in v0.1.10
func GetPasswordHashBase64 ¶ added in v0.1.10
func GetTokenHash ¶ added in v0.1.11
func ImportFile ¶
func IsCollectionOwner ¶ added in v0.1.4
func IsContentOwner ¶ added in v0.1.4
func JSONPayloadMiddleware ¶ added in v0.1.10
func JSONPayloadMiddleware(next echo.HandlerFunc) echo.HandlerFunc
func OpenApiMiddleware ¶ added in v0.2.3
func OpenApiMiddleware(log *zap.SugaredLogger) echo.MiddlewareFunc
this is required as ipfs pinning spec has strong requirements on response format
func ParseDealLabel ¶
func TracingMiddleware ¶ added in v0.2.3
func TransferFailed ¶ added in v0.1.9
func TransferFailed(st *filclient.ChannelState) (bool, string)
func TryExtractFSNode ¶
func WithContentLengthCheck ¶ added in v0.1.8
required for car uploads
func WithMultipartFormDataChecker ¶ added in v0.2.3
func WithMultipartFormDataChecker(next echo.HandlerFunc) echo.HandlerFunc
Types ¶
type ChanTrack ¶
type ChanTrack struct { Dbid uint Last *filclient.ChannelState }
type Content ¶ added in v0.1.8
type Content struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Cid DbCID `json:"cid"` Name string `json:"name"` UserID uint `json:"userId" gorm:"index"` Description string `json:"description"` Size int64 `json:"size"` Type ContentType `json:"type"` Active bool `json:"active"` Offloaded bool `json:"offloaded"` Replication int `json:"replication"` // TODO: shift most of the 'state' booleans in here into a single state // field, should make reasoning about things much simpler AggregatedIn uint `json:"aggregatedIn" gorm:"index:,option:CONCURRENTLY"` Aggregate bool `json:"aggregate"` Pinning bool `json:"pinning"` PinMeta string `json:"pinMeta"` Replace bool `json:"replace" gorm:"default:0"` Origins string `json:"origins"` Failed bool `json:"failed"` Location string `json:"location"` // If set, this content is part of a split dag. // In such a case, the 'root' content should be advertised on the dht, but // not have deals made for it, and the children should have deals made for // them (unlike with aggregates) DagSplit bool `json:"dagSplit"` SplitFrom uint `json:"splitFrom"` PinningStatus string `json:"pinningStatus" gorm:"-"` }
type ContentAddResponse ¶
type ContentCreateBody ¶
type ContentCreateBody struct { ContentInCollection Root string `json:"root"` Name string `json:"name"` Location string `json:"location"` Type ContentType `json:"type"` }
type ContentCreateResponse ¶
type ContentCreateResponse struct {
ID uint `json:"id"`
}
type ContentInCollection ¶
type ContentType ¶
type ContentType int64
const ( Unknown ContentType = iota File Directory )
func FindCIDType ¶
func FindCIDType(ctx context.Context, root cid.Cid, dserv ipld.NodeGetter) (contentType ContentType)
FindCIDType checks if a pinned CID (root) is a file, a dir or unknown Returns dbmgr.File or dbmgr.Directory on success Returns dbmgr.Unknown otherwise
type ContentWithPath ¶ added in v0.1.8
type DbCID ¶
type DbCID struct {
CID cid.Cid
}
func (DbCID) MarshalJSON ¶
func (*DbCID) UnmarshalJSON ¶
type GenericResponse ¶ added in v0.1.1
type GenericResponse struct {
Message string `json:"message"`
}
generic response models
type HttpError ¶
type HttpErrorResponse ¶ added in v0.1.1
type HttpErrorResponse struct {
Error HttpError `json:"error"`
}
type InitShuttleResponse ¶
type InviteCode ¶ added in v0.1.10
type PeeringPeerAddMessage ¶ added in v0.1.1
type PeeringPeerAddMessage struct { Message string `json:"message"` PeersAdd []peering.PeeringPeer `json:"peers"` }
type PeeringPeerRemoveMessage ¶ added in v0.1.1
type RetrievalFailureRecord ¶
type RetrievalProgress ¶
type RetrievalProgress struct { Wait chan struct{} EndErr error }
type ShuttleCreateContentBody ¶
type ShuttleCreateContentBody struct { ContentCreateBody Collections []string `json:"collections"` DagSplitRoot uint `json:"dagSplitRoot"` User uint `json:"user"` }
type ShuttleListResponse ¶
type ShuttleListResponse struct { Handle string `json:"handle"` Token string `json:"token"` Online bool `json:"online"` LastConnection time.Time `json:"lastConnection"` AddrInfo *peer.AddrInfo `json:"addrInfo"` Address address.Address `json:"address"` Hostname string `json:"hostname"` StorageStats *ShuttleStorageStats `json:"storageStats"` }
type ShuttleStorageStats ¶
type TrackingBlockstore ¶ added in v0.2.0
type TrackingBlockstore struct {
// contains filtered or unexported fields
}
func NewTrackingBlockstore ¶ added in v0.2.0
func NewTrackingBlockstore(bs blockstore.Blockstore, db *gorm.DB) *TrackingBlockstore
func (*TrackingBlockstore) AllKeysChan ¶ added in v0.2.0
func (tbs *TrackingBlockstore) AllKeysChan(context.Context) (<-chan cid.Cid, error)
func (*TrackingBlockstore) DeleteBlock ¶ added in v0.2.0
func (tbs *TrackingBlockstore) DeleteBlock(ctx context.Context, _ cid.Cid) error
func (*TrackingBlockstore) GetCounts ¶ added in v0.2.0
func (tbs *TrackingBlockstore) GetCounts(objects []Object) ([]int, error)
func (*TrackingBlockstore) GetSize ¶ added in v0.2.0
func (tbs *TrackingBlockstore) GetSize(ctx context.Context, c cid.Cid) (int, error)
func (*TrackingBlockstore) Has ¶ added in v0.2.0
func (tbs *TrackingBlockstore) Has(ctx context.Context, c cid.Cid) (bool, error)
func (*TrackingBlockstore) HashOnRead ¶ added in v0.2.0
func (tbs *TrackingBlockstore) HashOnRead(hashOnRead bool)
func (*TrackingBlockstore) LastAccess ¶ added in v0.2.0
func (*TrackingBlockstore) SetCidReqFunc ¶ added in v0.2.0
func (*TrackingBlockstore) Under ¶ added in v0.2.0
func (tbs *TrackingBlockstore) Under() blockstore.Blockstore
type User ¶ added in v0.1.10
type User struct { gorm.Model UUID string `gorm:"unique"` Username string `gorm:"unique"` Salt string PassHash string DID string UserEmail string Address DbAddr AuthToken AuthToken `gorm:"-"` Perm int Flags int StorageDisabled bool }
func (*User) FlagSplitContent ¶ added in v0.1.10
type UserSettings ¶
type UserSettings struct { Replication int `json:"replication"` Verified bool `json:"verified"` DealDuration abi.ChainEpoch `json:"dealDuration"` FileStagingThreshold int64 `json:"fileStagingThreshold"` ContentAddingDisabled bool `json:"contentAddingDisabled"` DealMakingDisabled bool `json:"dealMakingDisabled"` UploadEndpoints []string `json:"uploadEndpoints"` Flags int `json:"flags"` }
type ViewerResponse ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.