Skip to content

data.dedupestor #

Constants #

const max_value_size = 1024 * 1024 // 1MB

fn bytes_to_metadata #

fn bytes_to_metadata(b []u8) Metadata

bytes_to_metadata converts bytes back to Metadata

fn bytes_to_reference #

fn bytes_to_reference(b []u8) Reference

bytes_to_reference converts bytes to Reference

fn hash_data #

fn hash_data(data []u8) string

hash_data calculates the blake160 hash of the given data and returns it as a hex string.

struct Metadata #

struct Metadata {
pub:
	id u32
pub mut:
	references []Reference
}

Metadata represents a stored value with its ID and references

fn (Metadata) to_bytes #

fn (m Metadata) to_bytes() []u8

to_bytes converts Metadata to bytes for storage

fn (Metadata) add_reference #

fn (mut m Metadata) add_reference(ref Reference) !Metadata

add_reference adds a new reference if it doesn't already exist

fn (Metadata) remove_reference #

fn (mut m Metadata) remove_reference(ref Reference) !Metadata

remove_reference removes a reference if it exists

struct Reference #

struct Reference {
pub:
	owner u16
	id    u32
}

Reference represents a reference to stored data

fn (Reference) to_bytes #

fn (r Reference) to_bytes() []u8

to_bytes converts Reference to bytes