// This package contains all data that is saved on disc. So everything in the .ezs folder package store // .ezs directory structure // .ezs/ // backups/ -- Contains backups of old files // [a-zA-Z0-9\-_]{2}/ -- Custom Base64 encoded XXH3_128 prefix for the backups // [HASH] -- The backed up file, the hash is used to identify it. What about collisions? We mention that in the data file next to it // [HASH].ini -- The data file for file [HASH], contains things like filename and also collision data // superpositions/ -- Contains data about superpositions TODO: Define // config.ini -- Contains general config data import "core:mem" import "core:time" import "core:encoding/base64" Config_Backups :: struct { enabled: bool `ini:"default=true"`, interval: time.Duration `ini:"default=10m"`, } Config :: struct { backups: Config_Backups, } // Custom base64 tables ENC_TABLE := [64]byte { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_', } DEC_TABLE := [128]int { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, } base64_encode :: proc(data: []byte, allocator := context.allocator) -> (encoded: string, err: mem.Allocator_Error) #optional_allocator_error { return base64.encode(data, ENC_TABLE, allocator) } base64_decode :: proc(data: string, allocator := context.allocator) -> (decoded: []byte, err: mem.Allocator_Error) #optional_allocator_error { return base64.decode(data, DEC_TABLE, allocator) }