Documentation ¶
Index ¶
- func AddBlockToRegistry(log *ipfsLog.ZapEventLogger, b *block.Block, config *config.Config, ...) error
- func AddFileToRegistry(log *ipfsLog.ZapEventLogger, config *config.Config, ...) error
- func ConvertToBlock(log *ipfsLog.ZapEventLogger, filePath string) (*block.Block, error)
- func DeleteFileFromRegistry(log *ipfsLog.ZapEventLogger, config *config.Config, ...) error
- func DeserializeRegistry[R Registeries](log *ipfsLog.ZapEventLogger, data []byte) (R, error)
- func LoadRegistryFile[R Registeries](log *ipfsLog.ZapEventLogger, config *config.Config, filename string) (R, error)
- func SaveRegistryToFile(log *ipfsLog.ZapEventLogger, config *config.Config, registry interface{}) error
- func SerializeRegistry(log *ipfsLog.ZapEventLogger, registry interface{}) ([]byte, error)
- type BlockData
- type BlockRegistry
- type FileRegistry
- type IndexingRegistry
- type Registeries
- type RegistryMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBlockToRegistry ¶
func AddBlockToRegistry(log *ipfsLog.ZapEventLogger, b *block.Block, config *config.Config, fileCid path.ImmutablePath, provider peer.AddrInfo) error
AddBlockToRegistry adds a block and the data associated to the registry.
func AddFileToRegistry ¶
func AddFileToRegistry(log *ipfsLog.ZapEventLogger, config *config.Config, addFileTransac *transaction.AddFileTransaction) error
AddFileToRegistry adds a file and the data associated to the registry.
func ConvertToBlock ¶
ConvertToBlock reads the contents of the file at the given file path and converts it into a block.Block object.
func DeleteFileFromRegistry ¶
func DeleteFileFromRegistry(log *ipfsLog.ZapEventLogger, config *config.Config, deleteFileTransac *transaction.DeleteFileTransaction) error
DeleteFileFromRegistry deletes a file and the data associated from the registry.
func DeserializeRegistry ¶
func DeserializeRegistry[R Registeries](log *ipfsLog.ZapEventLogger, data []byte) (R, error)
DeserializeRegistry converts a byte slice to a registry struct.
func LoadRegistryFile ¶
func LoadRegistryFile[R Registeries](log *ipfsLog.ZapEventLogger, config *config.Config, filename string) (R, error)
LoadRegistryFile loads the registry data from the specified file path and returns it. The registry data is deserialized into the provided generic type R. It returns the deserialized registry data and any error encountered during the process.
func SaveRegistryToFile ¶
func SaveRegistryToFile(log *ipfsLog.ZapEventLogger, config *config.Config, registry interface{}) error
SaveRegistryToFile saves any registry to a JSON file.
func SerializeRegistry ¶
func SerializeRegistry(log *ipfsLog.ZapEventLogger, registry interface{}) ([]byte, error)
SerializeRegistry serializes any registry into a byte slice using JSON encoding.
Types ¶
type BlockData ¶
type BlockData struct { ID uint32 `json:"ID"` Key []byte `json:"key"` BlockCid cid.Cid `json:"cid"` Provider peer.AddrInfo `json:"provider"` }
BlockData represents the data associated with a block stored with IPFS.
type BlockRegistry ¶
type BlockRegistry struct {
Blocks []BlockData `json:"blocks"`
}
BlockRegistry represents a collection of block records.
type FileRegistry ¶
type FileRegistry struct { Filename []byte `json:"filename"` Extension []byte `json:"extension"` FileSize uint64 `json:"fileSize"` Checksum []byte `json:"checksum"` Providers []peer.AddrInfo `json:"providers"` FileCid cid.Cid `json:"fileCid"` TransactionTimestamp int64 `json:"transactionTimestamp"` }
FileRegistry represents a registry of owners' files.
type IndexingRegistry ¶
type IndexingRegistry struct {
IndexingFiles map[string][]FileRegistry
}
IndexingRegistry represents the registry for indexing files owned by a specific address.
type Registeries ¶
type Registeries interface { IndexingRegistry | FileRegistry | BlockRegistry | BlockData | RegistryMessage }
type RegistryMessage ¶
type RegistryMessage struct { OwnerPublicKey string Registry []FileRegistry }