core.flist #
fn merge #
fn merge(source string, destination string) !
merge merges two flists together.
- copies all routes
- copies all inodes with the following restrictions:
- no two entries can have the same inode number. this can happen by shifting an flist's inode numbers to start after the last inode number of the other flist.
- the changed flist should reflect the inode changes on all affected tables (extra and block).
- no two files that exist in the same dir can have the same name.
- if two files have the same name and have the same blocks, they are identical and won't be copied, otherwise, the incoming entry is renamed.
fn new #
fn new(args FlistGetArgs) !Flist
struct Block #
struct Block {
pub mut:
ino u64
id string
key string
}
struct Extra #
struct Extra {
pub mut:
ino u64
data string
}
struct Flist #
struct Flist {
path string
con sqlite.DB
}
fn (Flist) add_routes #
fn (mut f Flist) add_routes(new_routes []Route) !
add_routes adds routes to the route table of the flist
fn (Flist) copy #
fn (mut f Flist) copy(source string, destination string) !
copy copies an flist entry from source path to destination path.
fn (Flist) delete_match #
fn (mut f Flist) delete_match(pattern string) !
delete_match deletes any entry that matches pattern. it simply calls find() and deletes matching inodes.
fn (Flist) delete_path #
fn (mut f Flist) delete_path(path_ string) !
delete file or directory from flist. path is relative to flist root directory. empty path will delete all flist entries. (actual data is not deleted, only flist information)
fn (Flist) find #
fn (mut f Flist) find(pattern string) ![]Inode
find entries that match pattern, it uses the LIKE
operator; The percent sign (%) matches zero or more characters and the underscore (_) matches exactly one.
fn (Flist) get_routes #
fn (mut f Flist) get_routes() ![]Route
get_routes returns all flist routes
fn (Flist) list #
fn (mut f Flist) list(recursive bool) ![]Inode
list directories and files in root directory. if recursive is allowed directories are explored.
fn (Flist) update_routes #
fn (mut f Flist) update_routes(new_routes []Route) !
update_routes will overwrite the current routes with the new routes
struct FlistGetArgs #
struct FlistGetArgs {
path string @[required]
create bool
}
struct Inode #
struct Inode {
pub mut:
ino u64 @[primary; sql: serial]
parent u64
name string
size u64
uid u32
gid u32
mode u32
rdev u64
ctime i64
mtime i64
}
struct Route #
struct Route {
pub mut:
start u8
end u8
url string
}
struct Tag #
struct Tag {
pub mut:
key string @[primary]
value string
}