Documentation
¶
Index ¶
Constants ¶
const ( // Block sizes for different file categories NanoBlockSize = 1024 // 1KB for small files MiniBlockSize = 65536 // 64KB for medium files BlockSize = 1048576 // 1MB for large files // Thresholds for block size selection NanoThreshold = 100 * 1024 // 100KB MiniThreshold = 10 * 1024 * 1024 // 10MB // Protocol version ProtocolVersion = "v4" // Default IPFS API endpoint DefaultIPFSEndpoint = "http://localhost:5001" )
Variables ¶
This section is empty.
Functions ¶
func DeRandomizeBlock ¶
DeRandomizeBlock recovers original data using the OFF System algorithm This function is called for each block in the descriptor set
func GenerateRandomBlocks ¶
GenerateRandomBlocks creates randomized blocks using the OFF System algorithm
func XORBlocks ¶
XORBlocks returns the XOR of two byte slices (up to the length of the shorter slice)
func XORBlocksInPlace ¶
func XORBlocksInPlace(a, b []byte)
XORBlocksInPlace XORs b into a in place (up to the length of b)
Types ¶
type BlockCache ¶
type BlockCache struct {
// contains filtered or unexported fields
}
BlockCache manages block storage and retrieval
type FileRepresentation ¶
type FileRepresentation struct { FileName string `json:"filename"` FileSize int64 `json:"filesize"` BlockHashes []string `json:"block_hashes"` BlockSize int `json:"block_size"` Timestamp int64 `json:"timestamp"` ContentType string `json:"content_type"` Version string `json:"version"` Descriptors [][]string `json:"descriptors"` // OFF System descriptor lists }
FileRepresentation contains the metadata needed to reconstruct a file
type RandomFS ¶
type RandomFS struct {
// contains filtered or unexported fields
}
RandomFS represents the main filesystem instance
func NewRandomFS ¶
NewRandomFS creates a new RandomFS instance
func NewRandomFSWithOptions ¶
func NewRandomFSWithOptions(ipfsAPI string, dataDir string, cacheSize int64, skipIPFSTest bool) (*RandomFS, error)
NewRandomFSWithOptions creates a new RandomFS instance with options
func NewRandomFSWithoutIPFS ¶
NewRandomFSWithoutIPFS creates a new RandomFS instance without requiring IPFS
func (*RandomFS) RetrieveFile ¶
func (rfs *RandomFS) RetrieveFile(repHash string) ([]byte, *FileRepresentation, error)
RetrieveFile retrieves and reconstructs a file from its representation hash using OFF System algorithm