Documentation
¶
Index ¶
- Constants
- func GetDataDir() string
- func GetNetwork() string
- func SetDataDir(dir string)
- func SetNetwork(network string)
- type BlockIndex
- type ChainState
- func (s *ChainState) BeginTransaction() (*ChainStateTransaction, error)
- func (s *ChainState) CelestiaHeightOffset() (uint64, error)
- func (s *ChainState) ChainID() (string, error)
- func (s *ChainState) Close() error
- func (s *ChainState) FinalizedHeight() (uint64, error)
- func (s *ChainState) GetBlock(height uint64) (*types.Block, error)
- func (s *ChainState) GetBlockByHash(hash HashKey) (*types.Block, error)
- func (s *ChainState) GetChunk(key HashKey) ([]byte, bool, error)
- func (s *ChainState) GetChunkHash(key HashKey) (crypto.Hash, bool, error)
- func (s *ChainState) GetDirectoryManifest(id *types.BlobIdentifier) (*pbStorageV1.DirectoryManifest, bool, error)
- func (s *ChainState) GetFileManifest(id *types.BlobIdentifier) (*pbStorageV1.FileManifest, bool, error)
- func (s *ChainState) GetStateMMR(height uint64) (*mmr.MMR, error)
- func (s *ChainState) SetCelestiaHeightOffset(offset uint64) error
- func (s *ChainState) SetChainID(id string) error
- type ChainStateTransaction
- func (tx *ChainStateTransaction) Abort() error
- func (tx *ChainStateTransaction) Commit() error
- func (tx *ChainStateTransaction) GetChunk(key HashKey) ([]byte, bool, error)
- func (tx *ChainStateTransaction) GetChunkHash(key HashKey) (crypto.Hash, bool, error)
- func (tx *ChainStateTransaction) GetFileManifest(id *types.BlobIdentifier) (*pbStorageV1.FileManifest, bool, error)
- func (tx *ChainStateTransaction) PutBlock(height uint64, block *types.Block) error
- func (tx *ChainStateTransaction) PutChunk(key HashKey, value []byte, hash crypto.Hash) error
- func (tx *ChainStateTransaction) PutDirectoryManifest(id *types.BlobIdentifier, manifest *pbStorageV1.DirectoryManifest) error
- func (tx *ChainStateTransaction) PutFileManifest(id *types.BlobIdentifier, manifest *pbStorageV1.FileManifest) error
- func (tx *ChainStateTransaction) PutStateMMR(height uint64, mmr *mmr.MMR) error
- func (tx *ChainStateTransaction) PutStateMMRRaw(height uint64, raw []byte) error
- func (tx *ChainStateTransaction) SetFinalizedHeight(height uint64) error
- type ChunkIndex
- type DirectoryIndex
- type FileFilters
- type FileIndex
- type HashKey
- type IndexerDatabase
- func (idb *IndexerDatabase) Close() error
- func (idb *IndexerDatabase) GetBlockIndex(height uint64) (*BlockIndex, error)
- func (idb *IndexerDatabase) GetBlocks(limit, offset int) ([]*BlockIndex, error)
- func (idb *IndexerDatabase) GetChunksByBlockHeight(blockHeight uint64) ([]*ChunkIndex, error)
- func (idb *IndexerDatabase) GetDirectories(limit, offset int) ([]*DirectoryIndex, error)
- func (idb *IndexerDatabase) GetDirectoriesByBlockHeight(blockHeight uint64) ([]*DirectoryIndex, error)
- func (idb *IndexerDatabase) GetDirectoryByID(blobID string) (*DirectoryIndex, error)
- func (idb *IndexerDatabase) GetFileChunks(fileID string) ([]*ChunkIndex, error)
- func (idb *IndexerDatabase) GetFileIndex(blobID string) (*FileIndex, error)
- func (idb *IndexerDatabase) GetFiles(limit, offset int) ([]*FileIndex, error)
- func (idb *IndexerDatabase) GetFilesByBlockHeight(blockHeight uint64) ([]*FileIndex, error)
- func (idb *IndexerDatabase) GetLastIndexedHeight() (uint64, error)
- func (idb *IndexerDatabase) GetStorageAnalytics() (*StorageAnalytics, error)
- func (idb *IndexerDatabase) GetTotalBlocks() (int, error)
- func (idb *IndexerDatabase) GetTotalDirectories() (int, error)
- func (idb *IndexerDatabase) GetTotalFiles() (int, error)
- func (idb *IndexerDatabase) PutBlockIndex(block *BlockIndex) error
- func (idb *IndexerDatabase) PutChunkIndex(chunk *ChunkIndex) error
- func (idb *IndexerDatabase) PutDirectoryFile(directoryID string, fileID string, relativePath string) error
- func (idb *IndexerDatabase) PutDirectoryIndex(dir *DirectoryIndex) error
- func (idb *IndexerDatabase) PutFileChunk(fileID string, chunkID string, chunkIndex int) error
- func (idb *IndexerDatabase) PutFileIndex(file *FileIndex) error
- func (idb *IndexerDatabase) SearchFiles(query string, filters FileFilters, limit, offset int) ([]*FileIndex, error)
- type SearchResult
- type StorageAnalytics
- type UploadRecord
- type UploadRecordKey
- type UploadState
Constants ¶
const ( ChainStateDb = "chain.db" UploadStateDb = "upload.db" IndexerStateDb = "indexer.db" ChainIDMocha = "blobcast-mocha-1" ChainIDMammoth = "blobcast-mamo-1" ChainIDCelestia = "blobcast-1" CelestiaNamespace = "626C6F62636173742D31" // blobcast-1 StartHeightMocha = 6383285 StartHeightMammoth = 1000000000 // mammoth TODO StartHeightCelestia = 1000000000 // mainnet TODO )
Variables ¶
This section is empty.
Functions ¶
func GetDataDir ¶
func GetDataDir() string
func GetNetwork ¶
func GetNetwork() string
func SetDataDir ¶
func SetDataDir(dir string)
func SetNetwork ¶
func SetNetwork(network string)
Types ¶
type BlockIndex ¶ added in v0.2.0
type BlockIndex struct {
Height uint64 `json:"height"`
Hash string `json:"hash"`
Timestamp time.Time `json:"timestamp"`
CelestiaHeight uint64 `json:"celestia_height"`
ParentHash string `json:"parent_hash"`
DirsRoot string `json:"dirs_root"`
FilesRoot string `json:"files_root"`
ChunksRoot string `json:"chunks_root"`
StateRoot string `json:"state_root"`
TotalChunks int `json:"total_chunks"`
TotalFiles int `json:"total_files"`
TotalDirectories int `json:"total_directories"`
StorageUsed uint64 `json:"storage_used"`
}
type ChainState ¶
type ChainState struct {
// contains filtered or unexported fields
}
func GetChainState ¶
func GetChainState() (*ChainState, error)
func (*ChainState) BeginTransaction ¶
func (s *ChainState) BeginTransaction() (*ChainStateTransaction, error)
func (*ChainState) CelestiaHeightOffset ¶
func (s *ChainState) CelestiaHeightOffset() (uint64, error)
func (*ChainState) ChainID ¶
func (s *ChainState) ChainID() (string, error)
func (*ChainState) Close ¶
func (s *ChainState) Close() error
func (*ChainState) FinalizedHeight ¶
func (s *ChainState) FinalizedHeight() (uint64, error)
func (*ChainState) GetBlockByHash ¶
func (s *ChainState) GetBlockByHash(hash HashKey) (*types.Block, error)
func (*ChainState) GetChunkHash ¶ added in v0.2.0
func (*ChainState) GetDirectoryManifest ¶
func (s *ChainState) GetDirectoryManifest(id *types.BlobIdentifier) (*pbStorageV1.DirectoryManifest, bool, error)
func (*ChainState) GetFileManifest ¶
func (s *ChainState) GetFileManifest(id *types.BlobIdentifier) (*pbStorageV1.FileManifest, bool, error)
func (*ChainState) GetStateMMR ¶
func (s *ChainState) GetStateMMR(height uint64) (*mmr.MMR, error)
func (*ChainState) SetCelestiaHeightOffset ¶
func (s *ChainState) SetCelestiaHeightOffset(offset uint64) error
func (*ChainState) SetChainID ¶
func (s *ChainState) SetChainID(id string) error
type ChainStateTransaction ¶
type ChainStateTransaction struct {
// contains filtered or unexported fields
}
func NewChainStateTransaction ¶
func NewChainStateTransaction(state *ChainState) *ChainStateTransaction
func (*ChainStateTransaction) Abort ¶
func (tx *ChainStateTransaction) Abort() error
func (*ChainStateTransaction) Commit ¶
func (tx *ChainStateTransaction) Commit() error
func (*ChainStateTransaction) GetChunk ¶
func (tx *ChainStateTransaction) GetChunk(key HashKey) ([]byte, bool, error)
func (*ChainStateTransaction) GetChunkHash ¶ added in v0.2.0
func (*ChainStateTransaction) GetFileManifest ¶
func (tx *ChainStateTransaction) GetFileManifest(id *types.BlobIdentifier) (*pbStorageV1.FileManifest, bool, error)
func (*ChainStateTransaction) PutBlock ¶
func (tx *ChainStateTransaction) PutBlock(height uint64, block *types.Block) error
func (*ChainStateTransaction) PutDirectoryManifest ¶
func (tx *ChainStateTransaction) PutDirectoryManifest(id *types.BlobIdentifier, manifest *pbStorageV1.DirectoryManifest) error
func (*ChainStateTransaction) PutFileManifest ¶
func (tx *ChainStateTransaction) PutFileManifest(id *types.BlobIdentifier, manifest *pbStorageV1.FileManifest) error
func (*ChainStateTransaction) PutStateMMR ¶
func (tx *ChainStateTransaction) PutStateMMR(height uint64, mmr *mmr.MMR) error
func (*ChainStateTransaction) PutStateMMRRaw ¶ added in v0.2.0
func (tx *ChainStateTransaction) PutStateMMRRaw(height uint64, raw []byte) error
func (*ChainStateTransaction) SetFinalizedHeight ¶
func (tx *ChainStateTransaction) SetFinalizedHeight(height uint64) error
type ChunkIndex ¶ added in v0.2.0
type DirectoryIndex ¶ added in v0.2.0
type DirectoryIndex struct {
BlobID string `json:"blob_id"`
DirectoryName string `json:"directory_name"`
DirectoryHash string `json:"directory_hash"`
BlockHeight uint64 `json:"block_height"`
FileCount int `json:"file_count"`
TotalSize uint64 `json:"total_size"`
FileTypes []string `json:"file_types"`
SubPaths []string `json:"sub_paths"`
}
type FileFilters ¶ added in v0.2.0
type FileIndex ¶ added in v0.2.0
type FileIndex struct {
BlobID string `json:"blob_id"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
FileSize uint64 `json:"file_size"`
FileHash string `json:"file_hash"`
BlockHeight uint64 `json:"block_height"`
ChunkCount int `json:"chunk_count"`
DirectoryReferences []string `json:"directory_references"`
Tags []string `json:"tags"`
}
type IndexerDatabase ¶ added in v0.2.0
type IndexerDatabase struct {
// contains filtered or unexported fields
}
func NewIndexerDatabase ¶ added in v0.2.0
func NewIndexerDatabase(connectionString string) (*IndexerDatabase, error)
func (*IndexerDatabase) Close ¶ added in v0.2.0
func (idb *IndexerDatabase) Close() error
func (*IndexerDatabase) GetBlockIndex ¶ added in v0.2.0
func (idb *IndexerDatabase) GetBlockIndex(height uint64) (*BlockIndex, error)
func (*IndexerDatabase) GetBlocks ¶ added in v0.2.0
func (idb *IndexerDatabase) GetBlocks(limit, offset int) ([]*BlockIndex, error)
GetBlocks returns a paginated list of blocks ordered by height desc
func (*IndexerDatabase) GetChunksByBlockHeight ¶ added in v0.2.0
func (idb *IndexerDatabase) GetChunksByBlockHeight(blockHeight uint64) ([]*ChunkIndex, error)
GetChunksByBlockHeight returns all chunks in a specific block
func (*IndexerDatabase) GetDirectories ¶ added in v0.2.0
func (idb *IndexerDatabase) GetDirectories(limit, offset int) ([]*DirectoryIndex, error)
GetDirectories returns a paginated list of directories ordered by timestamp desc
func (*IndexerDatabase) GetDirectoriesByBlockHeight ¶ added in v0.2.0
func (idb *IndexerDatabase) GetDirectoriesByBlockHeight(blockHeight uint64) ([]*DirectoryIndex, error)
GetDirectoriesByBlockHeight returns all directories in a specific block
func (*IndexerDatabase) GetDirectoryByID ¶ added in v0.2.0
func (idb *IndexerDatabase) GetDirectoryByID(blobID string) (*DirectoryIndex, error)
GetDirectoryByID returns a directory by its blob ID
func (*IndexerDatabase) GetFileChunks ¶ added in v0.2.0
func (idb *IndexerDatabase) GetFileChunks(fileID string) ([]*ChunkIndex, error)
func (*IndexerDatabase) GetFileIndex ¶ added in v0.2.0
func (idb *IndexerDatabase) GetFileIndex(blobID string) (*FileIndex, error)
func (*IndexerDatabase) GetFiles ¶ added in v0.2.0
func (idb *IndexerDatabase) GetFiles(limit, offset int) ([]*FileIndex, error)
GetFiles returns a paginated list of files ordered by block height desc
func (*IndexerDatabase) GetFilesByBlockHeight ¶ added in v0.2.0
func (idb *IndexerDatabase) GetFilesByBlockHeight(blockHeight uint64) ([]*FileIndex, error)
GetFilesByBlockHeight returns all files in a specific block
func (*IndexerDatabase) GetLastIndexedHeight ¶ added in v0.2.0
func (idb *IndexerDatabase) GetLastIndexedHeight() (uint64, error)
func (*IndexerDatabase) GetStorageAnalytics ¶ added in v0.2.0
func (idb *IndexerDatabase) GetStorageAnalytics() (*StorageAnalytics, error)
func (*IndexerDatabase) GetTotalBlocks ¶ added in v0.2.0
func (idb *IndexerDatabase) GetTotalBlocks() (int, error)
GetTotalBlocks returns the total number of blocks
func (*IndexerDatabase) GetTotalDirectories ¶ added in v0.2.0
func (idb *IndexerDatabase) GetTotalDirectories() (int, error)
GetTotalDirectories returns the total number of directories
func (*IndexerDatabase) GetTotalFiles ¶ added in v0.2.0
func (idb *IndexerDatabase) GetTotalFiles() (int, error)
GetTotalFiles returns the total number of files
func (*IndexerDatabase) PutBlockIndex ¶ added in v0.2.0
func (idb *IndexerDatabase) PutBlockIndex(block *BlockIndex) error
func (*IndexerDatabase) PutChunkIndex ¶ added in v0.2.0
func (idb *IndexerDatabase) PutChunkIndex(chunk *ChunkIndex) error
PutChunkIndex stores a chunk index
func (*IndexerDatabase) PutDirectoryFile ¶ added in v0.2.0
func (idb *IndexerDatabase) PutDirectoryFile(directoryID string, fileID string, relativePath string) error
func (*IndexerDatabase) PutDirectoryIndex ¶ added in v0.2.0
func (idb *IndexerDatabase) PutDirectoryIndex(dir *DirectoryIndex) error
func (*IndexerDatabase) PutFileChunk ¶ added in v0.2.0
func (idb *IndexerDatabase) PutFileChunk(fileID string, chunkID string, chunkIndex int) error
func (*IndexerDatabase) PutFileIndex ¶ added in v0.2.0
func (idb *IndexerDatabase) PutFileIndex(file *FileIndex) error
func (*IndexerDatabase) SearchFiles ¶ added in v0.2.0
func (idb *IndexerDatabase) SearchFiles(query string, filters FileFilters, limit, offset int) ([]*FileIndex, error)
SearchFiles searches for files by filename with optional filters
type SearchResult ¶ added in v0.2.0
type SearchResult struct {
Type string `json:"type"` // "file", "directory", "block"
BlobID string `json:"blob_id"`
Title string `json:"title"`
Description string `json:"description"`
BlockHeight uint64 `json:"block_height"`
Timestamp time.Time `json:"timestamp"`
MatchScore float64 `json:"match_score"`
}
type StorageAnalytics ¶ added in v0.2.0
type StorageAnalytics struct {
TotalBlocks uint64 `json:"total_blocks"`
TotalChunks uint64 `json:"total_chunks"`
TotalFiles uint64 `json:"total_files"`
TotalDirectories uint64 `json:"total_directories"`
TotalStorage uint64 `json:"total_storage"`
AvgBlockSize uint64 `json:"avg_block_size"`
MostCommonMimeTypes map[string]int `json:"most_common_mime_types"`
FileTypeDistribution map[string]uint64 `json:"file_type_distribution"`
LargestFiles []*FileIndex `json:"largest_files"`
LargestDirectories []*DirectoryIndex `json:"largest_directories"`
}
type UploadRecord ¶
type UploadRecord struct {
Key UploadRecordKey `json:"key"`
Completed bool `json:"completed"`
ManifestID string `json:"manifest_id,omitempty"`
}
type UploadRecordKey ¶
type UploadRecordKey [32]byte
type UploadState ¶
type UploadState struct {
// contains filtered or unexported fields
}
func GetUploadState ¶
func GetUploadState() (*UploadState, error)
func (*UploadState) DeleteUploadRecord ¶
func (s *UploadState) DeleteUploadRecord(key UploadRecordKey) error
func (*UploadState) GetUploadRecord ¶
func (s *UploadState) GetUploadRecord(key UploadRecordKey) (*UploadRecord, error)
func (*UploadState) SaveUploadRecord ¶
func (s *UploadState) SaveUploadRecord(uploadRecord *UploadRecord) error