Documentation
¶
Index ¶
- Variables
- func Null[T any](v *T) sql.Null[T]
- func NullString(s *string) sql.NullString
- type FileInfo
- type Repo
- func (r *Repo) AddNodeToShard(ctx context.Context, shardID id.ShardID, nodeCID cid.Cid, spaceDID did.DID, ...) error
- func (r *Repo) AddSourceToSpace(ctx context.Context, spaceDID did.DID, sourceID id.SourceID) error
- func (r *Repo) CIDForFSEntry(ctx context.Context, fsEntryID id.FSEntryID) (cid.Cid, error)
- func (r *Repo) Close() error
- func (r *Repo) CompleteDAGScansForUpload(ctx context.Context, uploadID id.UploadID) ([]model.DAGScan, error)
- func (r *Repo) CreateDAGScan(ctx context.Context, fsEntryID id.FSEntryID, isDirectory bool, ...) (dagmodel.DAGScan, error)
- func (r *Repo) CreateDirectoryChildren(ctx context.Context, parent *scanmodel.Directory, children []scanmodel.FSEntry) error
- func (r *Repo) CreateLinks(ctx context.Context, parent cid.Cid, spaceDID did.DID, ...) error
- func (r *Repo) CreateShard(ctx context.Context, uploadID id.UploadID, size uint64, ...) (*model.Shard, error)
- func (r *Repo) CreateSource(ctx context.Context, name string, path string, ...) (*sourcemodel.Source, error)
- func (r *Repo) DeleteFSEntry(ctx context.Context, spaceDID did.DID, fsEntryID id.FSEntryID) error
- func (r *Repo) DeleteNodes(ctx context.Context, spaceDID did.DID, nodeCIDs []cid.Cid) error
- func (r *Repo) DeleteShard(ctx context.Context, shardID id.ShardID) error
- func (r *Repo) DeleteSpace(ctx context.Context, spaceDID did.DID) error
- func (r *Repo) DirectoryChildren(ctx context.Context, dir *scanmodel.Directory) ([]scanmodel.FSEntry, error)
- func (r *Repo) DirectoryLinks(ctx context.Context, dirScan *model.DirectoryDAGScan) ([]model.LinkParams, error)
- func (r *Repo) FilesToDAGScan(ctx context.Context, uploadID id.UploadID, count int) ([]FileInfo, error)
- func (r *Repo) FindNodeByCIDAndSpaceDID(ctx context.Context, c cid.Cid, spaceDID did.DID) (dagsmodel.Node, error)
- func (r *Repo) FindOrCreateDirectory(ctx context.Context, path string, lastModified time.Time, mode fs.FileMode, ...) (*scanmodel.Directory, bool, error)
- func (r *Repo) FindOrCreateFile(ctx context.Context, path string, lastModified time.Time, mode fs.FileMode, ...) (*scanmodel.File, bool, error)
- func (r *Repo) FindOrCreateRawNode(ctx context.Context, cid cid.Cid, size uint64, spaceDID did.DID, path string, ...) (*model.RawNode, bool, error)
- func (r *Repo) FindOrCreateSpace(ctx context.Context, did did.DID, name string, ...) (*spacesmodel.Space, error)
- func (r *Repo) FindOrCreateUnixFSNode(ctx context.Context, cid cid.Cid, size uint64, spaceDID did.DID, ...) (*model.UnixFSNode, bool, error)
- func (r *Repo) FindOrCreateUploads(ctx context.Context, spaceDID did.DID, sourceIDs []id.SourceID) ([]*model.Upload, error)
- func (r *Repo) ForEachNode(ctx context.Context, shardID id.ShardID, ...) error
- func (r *Repo) GetFileByID(ctx context.Context, fileID id.FSEntryID) (*scanmodel.File, error)
- func (r *Repo) GetShardByID(ctx context.Context, shardID id.ShardID) (*model.Shard, error)
- func (r *Repo) GetSourceByID(ctx context.Context, sourceID id.SourceID) (*sourcemodel.Source, error)
- func (r *Repo) GetSourceByName(ctx context.Context, name string) (*sourcemodel.Source, error)
- func (r *Repo) GetSpaceByDID(ctx context.Context, spaceDID did.DID) (*spacesmodel.Space, error)
- func (r *Repo) GetSpaceByName(ctx context.Context, name string) (*spacesmodel.Space, error)
- func (r *Repo) GetUploadByID(ctx context.Context, uploadID id.UploadID) (*model.Upload, error)
- func (r *Repo) HasIncompleteChildren(ctx context.Context, directoryScans *model.DirectoryDAGScan) (bool, error)
- func (r *Repo) IncompleteDAGScansForUpload(ctx context.Context, uploadID id.UploadID) ([]model.DAGScan, error)
- func (r *Repo) LinksForCID(ctx context.Context, c cid.Cid, sd did.DID) ([]*model.Link, error)
- func (r *Repo) ListSpaceSources(ctx context.Context, spaceDID did.DID) ([]id.SourceID, error)
- func (r *Repo) ListSpaces(ctx context.Context) ([]*spacesmodel.Space, error)
- func (r *Repo) NodesByShard(ctx context.Context, shardID id.ShardID, startOffset uint64) ([]dagsmodel.Node, error)
- func (r *Repo) RemoveSourceFromSpace(ctx context.Context, spaceDID did.DID, sourceID id.SourceID) error
- func (r *Repo) ShardedFiles(ctx context.Context, uploadID id.UploadID, count int) ([]FileInfo, error)
- func (r *Repo) ShardsForUploadByState(ctx context.Context, uploadID id.UploadID, state model.ShardState) ([]*model.Shard, error)
- func (r *Repo) TotalBytesToScan(ctx context.Context, uploadID id.UploadID) (uint64, error)
- func (r *Repo) UpdateDAGScan(ctx context.Context, dagScan model.DAGScan) error
- func (r *Repo) UpdateShard(ctx context.Context, shard *model.Shard) error
- func (r *Repo) UpdateSource(ctx context.Context, src *sourcemodel.Source) error
- func (r *Repo) UpdateUpload(ctx context.Context, upload *model.Upload) error
- type RowScanner
Constants ¶
This section is empty.
Variables ¶
var MigrationsFS embed.FS
var Schema string
Functions ¶
func NullString ¶
func NullString(s *string) sql.NullString
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) AddNodeToShard ¶
func (r *Repo) AddNodeToShard(ctx context.Context, shardID id.ShardID, nodeCID cid.Cid, spaceDID did.DID, offset uint64, options ...shards.AddNodeToShardOption) error
AddNodeToShard adds a node to a shard in the repository. Note: the [offset] is NOT the absolute offset within the shard, but the offset into the *new* bytes in the shard CAR where the node data begins--in other words, the length of the length varint + the length of the CID bytes. The node's block will be indexed as appearing at `shard.size + offset`, running for `node.size` bytes, and then the shard size will be increased by `offset + node.size`.
func (*Repo) AddSourceToSpace ¶
AddSourceToSpace adds a source to a space in the repository.
func (*Repo) CIDForFSEntry ¶
func (*Repo) CompleteDAGScansForUpload ¶
func (*Repo) CreateDAGScan ¶
func (*Repo) CreateDirectoryChildren ¶
func (r *Repo) CreateDirectoryChildren(ctx context.Context, parent *scanmodel.Directory, children []scanmodel.FSEntry) error
CreateDirectoryChildren links a directory to its children in the repository.
func (*Repo) CreateLinks ¶
func (r *Repo) CreateLinks(ctx context.Context, parent cid.Cid, spaceDID did.DID, linkParams []model.LinkParams) error
CreateLinks creates links in the repository for the given parent CID and link parameters.
func (*Repo) CreateShard ¶
func (*Repo) CreateSource ¶
func (r *Repo) CreateSource(ctx context.Context, name string, path string, options ...sourcemodel.SourceOption) (*sourcemodel.Source, error)
CreateSource creates a new source in the repository with the given name, path, and options.
func (*Repo) DeleteFSEntry ¶
func (*Repo) DeleteNodes ¶
func (*Repo) DeleteShard ¶
func (*Repo) DeleteSpace ¶
DeleteSpace deletes a space from the repository.
func (*Repo) DirectoryChildren ¶
func (r *Repo) DirectoryChildren(ctx context.Context, dir *scanmodel.Directory) ([]scanmodel.FSEntry, error)
DirectoryChildren retrieves the children of a directory from the repository.
func (*Repo) DirectoryLinks ¶
func (r *Repo) DirectoryLinks(ctx context.Context, dirScan *model.DirectoryDAGScan) ([]model.LinkParams, error)
DirectoryLinks retrieves link parameters for a given directory scan.
func (*Repo) FilesToDAGScan ¶
func (*Repo) FindNodeByCIDAndSpaceDID ¶
func (*Repo) FindOrCreateDirectory ¶
func (r *Repo) FindOrCreateDirectory(ctx context.Context, path string, lastModified time.Time, mode fs.FileMode, checksum []byte, sourceID id.SourceID, spaceDID did.DID) (*scanmodel.Directory, bool, error)
FindOrCreateDirectory finds or creates a directory entry in the repository with the given parameters. If the directory already exists, it returns the existing directory and false. If the directory does not exist, it creates a new directory entry and returns it along with true.
func (*Repo) FindOrCreateFile ¶
func (r *Repo) FindOrCreateFile(ctx context.Context, path string, lastModified time.Time, mode fs.FileMode, size uint64, checksum []byte, sourceID id.SourceID, spaceDID did.DID) (*scanmodel.File, bool, error)
FindOrCreateFile finds or creates a file entry in the repository with the given parameters. If the file already exists, it returns the existing file and false. If the file does not exist, it creates a new file entry and returns it along with true.
func (*Repo) FindOrCreateRawNode ¶
func (r *Repo) FindOrCreateRawNode(ctx context.Context, cid cid.Cid, size uint64, spaceDID did.DID, path string, sourceID id.SourceID, offset uint64) (*model.RawNode, bool, error)
FindOrCreateRawNode finds or creates a raw node in the repository. If a node with the same CID, size, path, source ID, and offset already exists, it returns that node. If not, it creates a new raw node with the provided parameters.
func (*Repo) FindOrCreateSpace ¶
func (r *Repo) FindOrCreateSpace(ctx context.Context, did did.DID, name string, options ...spacesmodel.SpaceOption) (*spacesmodel.Space, error)
FindOrCreateSpace finds an existing space or creates a new one in the repository with the given name and options.
func (*Repo) FindOrCreateUnixFSNode ¶
func (r *Repo) FindOrCreateUnixFSNode(ctx context.Context, cid cid.Cid, size uint64, spaceDID did.DID, ufsdata []byte) (*model.UnixFSNode, bool, error)
FindOrCreateUnixFSNode finds or creates a UnixFS node in the repository. If a node with the same CID, size, and ufsdata already exists, it returns that node. If not, it creates a new UnixFS node with the provided parameters.
func (*Repo) FindOrCreateUploads ¶
func (r *Repo) FindOrCreateUploads(ctx context.Context, spaceDID did.DID, sourceIDs []id.SourceID) ([]*model.Upload, error)
FindOrCreateUploads creates uploads for a given space and source IDs.
func (*Repo) ForEachNode ¶
func (*Repo) GetFileByID ¶
GetFileByID retrieves a file by its unique ID from the repository.
func (*Repo) GetShardByID ¶
func (*Repo) GetSourceByID ¶
func (r *Repo) GetSourceByID(ctx context.Context, sourceID id.SourceID) (*sourcemodel.Source, error)
GetSourceByID retrieves a source by its unique ID from the repository.
func (*Repo) GetSourceByName ¶
GetSourceByName retrieves a source by its name from the repository.
func (*Repo) GetSpaceByDID ¶
GetSpaceByDID retrieves a space by its unique DID from the repository.
func (*Repo) GetSpaceByName ¶
GetSpaceByName retrieves a space by its name from the repository.
func (*Repo) GetUploadByID ¶
GetUploadByID retrieves an upload by its unique ID from the repository.
func (*Repo) HasIncompleteChildren ¶
func (r *Repo) HasIncompleteChildren(ctx context.Context, directoryScans *model.DirectoryDAGScan) (bool, error)
HasIncompleteChildren returns whether the given directory scan has at least one child scan that is not completed.
func (*Repo) IncompleteDAGScansForUpload ¶
func (*Repo) LinksForCID ¶
func (*Repo) ListSpaceSources ¶
ListSpaceSources lists all sources associated with a given space DID.
func (*Repo) ListSpaces ¶
ListSpaces lists all spaces in the repository.
func (*Repo) NodesByShard ¶
func (*Repo) RemoveSourceFromSpace ¶
func (r *Repo) RemoveSourceFromSpace(ctx context.Context, spaceDID did.DID, sourceID id.SourceID) error
RemoveSourceFromSpace removes a source from a space in the repository.
func (*Repo) ShardedFiles ¶
func (*Repo) ShardsForUploadByState ¶
func (*Repo) TotalBytesToScan ¶
func (*Repo) UpdateDAGScan ¶
UpdateDAGScan updates a DAG scan in the repository.
func (*Repo) UpdateShard ¶
UpdateShard updates a DAG scan in the repository.
func (*Repo) UpdateSource ¶
UpdateSource updates the given source in the repository.
type RowScanner ¶
RowScanner can scan a row into a set of destinations. It should not be confused with sql.Scanner, which is used to scan a single value.