Skip to content

hero.herofs #

HeroFS - Distributed Filesystem for HeroLib

HeroFS is a distributed filesystem implementation built on top of HeroDB (Redis-based storage). It provides a virtual filesystem with support for files, directories, symbolic links, and binary data blobs.

Overview

HeroFS implements a filesystem structure where:

  • Fs: Represents a filesystem as a top-level container
  • FsDir: Represents directories within a filesystem
  • FsFile: Represents files with support for multiple directory associations
  • FsSymlink: Represents symbolic links pointing to files or directories
  • FsBlob: Represents binary data chunks (up to 1MB) used as file content

Features

  • Distributed storage using Redis
  • Support for files, directories, and symbolic links
  • Blob-based file content storage with integrity verification
  • Multiple directory associations for files (similar to hard links)
  • Filesystem quotas and usage tracking
  • Metadata support for files
  • Efficient lookup mechanisms using Redis hash sets

Installation

HeroFS is part of HeroLib and is automatically available when using HeroLib.

Usage

To use HeroFS, you need to create a filesystem factory:

import incubaid.herolib.hero.herofs

mut fs_factory := herofs.new()!

Creating a Filesystem

mut fs := fs_factory.fs.new(
 name: 'my_filesystem'
 quota_bytes: 1000000000 // 1GB quota
)!
fs = fs_factory.fs.set(fs)!
fs_id := fs.id

Working with Directories

// Create root directory
mut root_dir := fs_factory.fs_dir.new(
 name: 'root'
 fs_id: fs_id
 parent_id: 0
)!
root_dir_id := fs_factory.fs_dir.set(root_dir)!

// Create subdirectory
mut sub_dir := fs_factory.fs_dir.new(
 name: 'documents'
 fs_id: fs_id
 parent_id: root_dir_id
)!
sub_dir_id := fs_factory.fs_dir.set(sub_dir)!

Working with Blobs

// Create a blob with binary data
mut blob := fs_factory.fs_blob.new(
 data: content_bytes
 mime_type: 'text/plain'
)!
blob_id := fs_factory.fs_blob.set(blob)!

Working with Files

// Create a file
mut file := fs_factory.fs_file.new(
 name: 'example.txt'
 fs_id: fs_id
 directories: [root_dir_id]
 blobs: [blob_id]
)!
file_id := fs_factory.fs_file.set(file)!
// Create a symbolic link to a file
mut symlink := fs_factory.fs_symlink.new(
 name: 'example_link.txt'
 fs_id: fs_id
 parent_id: root_dir_id
 target_id: file_id
 target_type: .file
)!
symlink_id := fs_factory.fs_symlink.set(symlink)!

API Reference

The HeroFS module provides the following main components:

  • FsFactory - Main factory for accessing all filesystem components
  • DBFs - Filesystem operations
  • DBFsDir - Directory operations
  • DBFsFile - File operations
  • DBFsSymlink - Symbolic link operations
  • DBFsBlob - Binary data blob operations

Each component provides CRUD operations and specialized methods for filesystem management.

Examples

Check the examples/hero/herofs/ directory for detailed usage examples.

fn delete_fs_test #

fn delete_fs_test() !

fn extension_to_mime_type #

fn extension_to_mime_type(ext string) MimeType

extension_to_mime_type converts file extension to MimeType enum

fn fs_blob_handle #

fn fs_blob_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn fs_blob_membership_handle #

fn fs_blob_membership_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn fs_dir_handle #

fn fs_dir_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn fs_file_handle #

fn fs_file_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn fs_handle #

fn fs_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn mime_type_to_string #

fn mime_type_to_string(m MimeType) string

fn new #

fn new(args DBArgs) !FSFactory

fn new_fs #

fn new_fs(args FsArg) !Fs

Convenience function for creating a filesystem

fn new_fs_test #

fn new_fs_test() !Fs

fn new_test #

fn new_test() !FSFactory

fn string_to_mime_type #

fn string_to_mime_type(s string) ?MimeType

enum FSItemType #

enum FSItemType {
	file
	directory
	symlink
}

FSItemType indicates what type of filesystem object was found

enum MimeType #

enum MimeType {
	aac
	abiword
	apng
	freearc
	avif
	avi
	azw
	bin
	bmp
	bz
	bz2
	cda
	csh
	css
	csv
	doc
	docx
	eot
	epub
	gz
	gif
	html
	ico
	ics
	jar
	jpg
	js
	json
	jsonld
	md
	midi
	mjs
	mp3
	mp4
	mpeg
	mpkg
	odp
	ods
	odt
	oga
	ogv
	ogx
	opus
	otf
	png
	pdf
	php
	ppt
	pptx
	rar
	rtf
	sh
	svg
	tar
	tiff
	ts
	ttf
	txt
	vsd
	wav
	weba
	webm
	manifest
	webp
	woff
	woff2
	xhtml
	xls
	xlsx
	xml
	xul
	zip
	gp3
	gpp2
	sevenz
}

see https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types

enum SymlinkTargetType #

enum SymlinkTargetType {
	file
	directory
}

struct BlobList #

struct BlobList {
pub mut:
	id   u32
	hash string
	size int
}

BlobList represents a simplified blob structure for listing purposes

struct CopyOptions #

@[params]
struct CopyOptions {
pub mut:
	recursive  bool = true // Copy directories recursively
	overwrite  bool // Overwrite existing files at destination
	copy_blobs bool // Create new blob copies (true) or reference same blobs (false)
}

CopyOptions provides options for copy operations

struct DBArgs #

@[params]
struct DBArgs {
pub mut:
	redis ?&redisclient.Redis
}

struct DBFs #

struct DBFs {
pub mut:
	db      &db.DB     @[skip; str: skip]
	factory &FSFactory = unsafe { nil } @[skip; str: skip]
}

We only keep the root directory ID here, other directories can be found by querying parent_id in FsDir

fn (DBFs) new #

fn (mut self DBFs) new(args FsArg) !Fs

get new filesystem, not from the DB

fn (DBFs) new_get_set #

fn (mut self DBFs) new_get_set(args_ FsArg) !Fs

get new filesystem, if it exists then it will get it from the DB

fn (DBFs) set #

fn (mut self DBFs) set(o Fs) !Fs

fn (DBFs) delete #

fn (mut self DBFs) delete(id u32) !

fn (DBFs) exist #

fn (mut self DBFs) exist(id u32) !bool

fn (DBFs) get #

fn (mut self DBFs) get(id u32) !Fs

fn (DBFs) list #

fn (mut self DBFs) list(args FsListArg) ![]Fs

fn (DBFs) get_by_name #

fn (mut self DBFs) get_by_name(name string) !Fs

Additional hset operations for efficient lookups

fn (DBFs) increase_usage #

fn (mut self DBFs) increase_usage(id u32, bytes u64) !

Increase used bytes counter

fn (DBFs) decrease_usage #

fn (mut self DBFs) decrease_usage(id u32, bytes u64) !

Decrease used bytes counter

fn (DBFs) check_quota #

fn (mut self DBFs) check_quota(id u32, additional_bytes u64) !bool

Check if quota is exceeded

struct DBFsBlob #

struct DBFsBlob {
pub mut:
	db      &db.DB     @[skip; str: skip]
	factory &FSFactory = unsafe { nil } @[skip; str: skip]
}

Update DBFsBlob struct:

fn (DBFsBlob) new #

fn (mut self DBFsBlob) new(args FsBlobArg) !FsBlob

get new blob, not from the DB

fn (DBFsBlob) set #

fn (mut self DBFsBlob) set(o_ FsBlob) !FsBlob

fn (DBFsBlob) delete #

fn (mut self DBFsBlob) delete(id u32) !

fn (DBFsBlob) delete_multi #

fn (mut self DBFsBlob) delete_multi(ids []u32) !

fn (DBFsBlob) exist #

fn (mut self DBFsBlob) exist(id u32) !bool

fn (DBFsBlob) exist_multi #

fn (mut self DBFsBlob) exist_multi(ids []u32) !bool

fn (DBFsBlob) get #

fn (mut self DBFsBlob) get(id u32) !FsBlob

fn (DBFsBlob) get_multi #

fn (mut self DBFsBlob) get_multi(id []u32) ![]FsBlob

fn (DBFsBlob) list #

fn (mut self DBFsBlob) list() ![]FsBlob

fn (DBFsBlob) get_by_hash #

fn (mut self DBFsBlob) get_by_hash(hash string) !FsBlob

fn (DBFsBlob) exists_by_hash #

fn (mut self DBFsBlob) exists_by_hash(hash string) !bool

fn (DBFsBlob) verify #

fn (mut self DBFsBlob) verify(hash string) !bool

struct DBFsBlobMembership #

struct DBFsBlobMembership {
pub mut:
	db      &db.DB     @[skip; str: skip]
	factory &FSFactory = unsafe { nil } @[skip; str: skip]
}

fn (DBFsBlobMembership) new #

fn (self DBFsBlobMembership) new(args FsBlobMembershipArg) !FsBlobMembership

fn (DBFsBlobMembership) set #

fn (mut self DBFsBlobMembership) set(o FsBlobMembership) !FsBlobMembership

fn (DBFsBlobMembership) delete #

fn (mut self DBFsBlobMembership) delete(hash string) !

fn (DBFsBlobMembership) exist #

fn (mut self DBFsBlobMembership) exist(hash string) !bool

fn (DBFsBlobMembership) get #

fn (mut self DBFsBlobMembership) get(hash string) !FsBlobMembership

fn (DBFsBlobMembership) add_filesystem #

fn (mut self DBFsBlobMembership) add_filesystem(hash string, fs_id u32) !

Add a filesystem to an existing blob membership

fn (DBFsBlobMembership) remove_filesystem #

fn (mut self DBFsBlobMembership) remove_filesystem(hash string, fs_id u32) !

Remove a filesystem from an existing blob membership

fn (DBFsBlobMembership) list_prefix #

fn (mut self DBFsBlobMembership) list_prefix(prefix string) ![]FsBlobMembership

list_by_hash_prefix lists blob memberships where hash starts with the given prefix Returns maximum 10000 items as FsBlobMembership entries

struct DBFsDir #

struct DBFsDir {
pub mut:
	db      &db.DB     @[skip; str: skip]
	factory &FSFactory = unsafe { nil } @[skip; str: skip]
}

fn (DBFsDir) new #

fn (mut self DBFsDir) new(args FsDirArg) !FsDir

get new directory, not from the DB

fn (DBFsDir) set #

fn (mut self DBFsDir) set(o FsDir) !FsDir

fn (DBFsDir) delete #

fn (mut self DBFsDir) delete(id u32) !

fn (DBFsDir) exist #

fn (mut self DBFsDir) exist(id u32) !bool

fn (DBFsDir) get #

fn (mut self DBFsDir) get(id u32) !FsDir

fn (DBFsDir) create_path #

fn (mut self DBFsDir) create_path(fs_id u32, path string) !u32

create_path creates a directory at the specified path, creating parent directories as needed

fn (DBFsDir) list #

fn (mut self DBFsDir) list() ![]FsDir

List all directories

fn (DBFsDir) list_by_filesystem #

fn (mut self DBFsDir) list_by_filesystem(fs_id u32) ![]FsDir

List directories in a filesystem

fn (DBFsDir) list_children #

fn (mut self DBFsDir) list_children(dir_id u32) ![]FsDir

List child directories

fn (DBFsDir) has_children #

fn (mut self DBFsDir) has_children(dir_id u32) !bool

Check if directory has children

fn (DBFsDir) rename #

fn (mut self DBFsDir) rename(id u32, new_name string) !

Rename directory

fn (DBFsDir) move #

fn (mut self DBFsDir) move(id u32, new_parent_id u32) !

Move directory to a new parent

struct DBFsFile #

struct DBFsFile {
pub mut:
	db      &db.DB     @[skip; str: skip]
	factory &FSFactory = unsafe { nil } @[skip; str: skip]
}

fn (DBFsFile) new #

fn (mut self DBFsFile) new(args FsFileArg) !FsFile

get new file, not from the DB

fn (DBFsFile) set #

fn (mut self DBFsFile) set(o_ FsFile) !FsFile

fn (DBFsFile) add_to_directory #

fn (mut self DBFsFile) add_to_directory(file_id u32, dir_id u32) !

add_to_directory adds a file to a directory's files list

fn (DBFsFile) remove_from_directory #

fn (mut self DBFsFile) remove_from_directory(file_id u32, dir_id u32) !

remove_from_directory removes a file from a directory's files list

fn (DBFsFile) delete #

fn (mut self DBFsFile) delete(id u32) !

fn (DBFsFile) exist #

fn (mut self DBFsFile) exist(id u32) !bool

fn (DBFsFile) get #

fn (mut self DBFsFile) get(id u32) !FsFile

fn (DBFsFile) update_accessed #

fn (mut self DBFsFile) update_accessed(id u32) !

Update file accessed timestamp

fn (DBFsFile) update_metadata #

fn (mut self DBFsFile) update_metadata(id u32, key string, value string) !

Update file metadata

fn (DBFsFile) rename #

fn (mut self DBFsFile) rename(id u32, new_name string) !

Rename file (affects all directories)

fn (DBFsFile) move #

fn (mut self DBFsFile) move(id u32, new_dir_ids []u32) !

Move file to different directories

fn (DBFsFile) append_blob #

fn (mut self DBFsFile) append_blob(id u32, blob_id u32) !

Append a blob to the file

fn (DBFsFile) list #

fn (mut self DBFsFile) list() ![]FsFile

List all files

fn (DBFsFile) get_by_path #

fn (mut self DBFsFile) get_by_path(dir_id u32, name string) !FsFile

Get file by path (directory and name)

fn (DBFsFile) list_by_directory #

fn (mut self DBFsFile) list_by_directory(dir_id u32) ![]FsFile

List files in a directory

fn (DBFsFile) list_by_filesystem #

fn (mut self DBFsFile) list_by_filesystem(fs_id u32) ![]FsFile

List files in a filesystem

fn (DBFsFile) list_by_mime_type #

fn (mut self DBFsFile) list_by_mime_type(mime_type MimeType) ![]FsFile

List files by MIME type

fn (DBFsFile) list_directories_for_file #

fn (mut self DBFsFile) list_directories_for_file(file_id u32) ![]u32

Helper method to find which directories contain a file

fn (DBFsSymlink) new #

fn (mut self DBFsSymlink) new(args FsSymlinkArg) !FsSymlink

get new symlink, not from the DB

fn (DBFsSymlink) set #

fn (mut self DBFsSymlink) set(o FsSymlink) !FsSymlink

fn (DBFsSymlink) delete #

fn (mut self DBFsSymlink) delete(id u32) !

fn (DBFsSymlink) exist #

fn (mut self DBFsSymlink) exist(id u32) !bool

fn (DBFsSymlink) get #

fn (mut self DBFsSymlink) get(id u32) !FsSymlink

fn (DBFsSymlink) list #

fn (mut self DBFsSymlink) list() ![]FsSymlink

List all symlinks

fn (DBFsSymlink) list_by_filesystem #

fn (mut self DBFsSymlink) list_by_filesystem(fs_id u32) ![]FsSymlink

List symlinks in a filesystem

fn (DBFsSymlink) is_broken #

fn (mut self DBFsSymlink) is_broken(id u32) !bool

Check if symlink is broken (target doesn't exist)

struct ExportOptions #

@[params]
struct ExportOptions {
pub mut:
	recursive     bool = true // Export directories recursively
	overwrite     bool // Overwrite existing files on real filesystem
	preserve_meta bool = true // Preserve file metadata (timestamps, etc.)
}

ExportOptions provides options for export operations

struct FSFactory #

@[heap]
struct FSFactory {
pub mut:
	fs                 DBFs
	fs_blob            DBFsBlob
	fs_blob_membership DBFsBlobMembership
	fs_dir             DBFsDir
	fs_file            DBFsFile
	fs_symlink         DBFsSymlink
}

struct FindOptions #

@[params]
struct FindOptions {
pub mut:
	recursive        bool = true
	include_patterns []string // File/directory name patterns to include (e.g. ['*.v', 'doc*'])
	exclude_patterns []string // File/directory name patterns to exclude
	max_depth        int = -1 // Maximum depth to search (-1 for unlimited)
	follow_symlinks  bool // Whether to follow symbolic links during search
}

FindOptions provides options for filesystem search operations

struct FindResult #

struct FindResult {
pub mut:
	result_type FSItemType
	id          u32
	path        string
}

FindResult represents the result of a filesystem search

struct Fs #

@[heap]
struct Fs {
	db.Base
pub mut:
	name        string
	group_id    u32 // Associated group for permissions
	root_dir_id u32 // ID of root directory
	quota_bytes u64 // Storage quota in bytes
	used_bytes  u64 // Current usage in bytes
	factory     &FSFactory = unsafe { nil } @[skip; str: skip]
}

Fs represents a filesystem, is the top level container for files and directories and symlinks, blobs are used over filesystems

fn (Fs) cp #

fn (mut self Fs) cp(src_path string, dest_path string, find_opts FindOptions, copy_opts CopyOptions) !

cp copies files and directories from source path to destination

Parameters:- src_path: Source path pattern (can use wildcards via FindOptions)

  • dest_path: Destination path
  • find_opts: FindOptions for filtering source items
  • copy_opts: CopyOptions for copy behavior

Example

fs.cp('/src/*.v', '/backup/', FindOptions{recursive: true}, CopyOptions{overwrite: true})!

fn (Fs) description #

fn (self Fs) description(methodname string) string

return example rpc call and result for each methodname

fn (Fs) dump #

fn (self Fs) dump(mut e encoder.Encoder) !

fn (Fs) example #

fn (self Fs) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Fs) export #

fn (mut self Fs) export(src string, dest string, opts ExportOptions) !

export copies data from VFS to the real filesystem

Parameters:- src: Source path in VFS

  • dest: Destination path on real filesystem
  • opts: ExportOptions for export behavior

Example

fs.export('/documents', '/home/user/backup', ExportOptions{recursive: true, overwrite: true})!

fn (Fs) find #

fn (mut self Fs) find(start_path string, opts FindOptions) ![]FindResult

find searches for filesystem objects starting from a given path

Parameters:- start_path: The path to start searching from

  • opts: FindOptions struct with search parameters

Returns:- []FindResult: Array of found filesystem objects

Example

results := tools.find('/', FindOptions{
    recursive: true
    include_patterns: ['*.v']
    exclude_patterns: ['*test*']
})!

fn (Fs) get_abs_path_for_item #

fn (mut self Fs) get_abs_path_for_item(id u32, item_type FSItemType) !string

get_abs_path_for_item returns the absolute path for a given filesystem item ID and type

fn (Fs) get_dir_by_absolute_path #

fn (mut self Fs) get_dir_by_absolute_path(path string) !FsDir

get_dir_by_absolute_path resolves an absolute path to a directory ID

Parameters:- path: The absolute path to resolve (e.g., "/", "/home", "/home/user/documents")

Returns:- FsDir: The directory object at the specified path

Example

dir := tools.get_dir_by_absolute_path('/home/user/documents')!

fn (Fs) get_dir_path #

fn (mut self Fs) get_dir_path(dir_id u32) !string

get_dir_path returns the absolute path for a given directory ID.

fn (Fs) get_file_by_absolute_path #

fn (mut self Fs) get_file_by_absolute_path(path string) !FsFile

get_file_by_absolute_path resolves an absolute path to a file

Parameters:- path: The absolute path to resolve (e.g., "/home/user/document.txt")

Returns:- FsFile: The file object at the specified path

Example

file := tools.get_file_by_absolute_path('/home/user/document.txt')!

fn (Fs) import #

fn (mut self Fs) import(src string, dest string, opts ImportOptions) !

import copies data from the real filesystem into the VFS

Parameters:- src: Source path on real filesystem

  • dest: Destination path in VFS
  • opts: ImportOptions for import behavior

Example

fs.import('/home/user/documents', '/imported', ImportOptions{recursive: true, overwrite: true})!

fn (Fs) mv #

fn (mut self Fs) mv(src_path string, dest_path string, opts MoveOptions) !

mv moves files and directories from source path to destination

Parameters:- src_path: Source path (exact path, not pattern)

  • dest_path: Destination path
  • opts: MoveOptions for move behavior

Example

fs.mv('/src/main.v', '/backup/main.v', MoveOptions{overwrite: true})!

fn (Fs) rm #

fn (mut self Fs) rm(path string, find_opts FindOptions, remove_opts RemoveOptions) !

rm removes files and directories matching the given path pattern

Parameters:- path: Path pattern to match for removal

  • find_opts: FindOptions for filtering items to remove
  • remove_opts: RemoveOptions for removal behavior

Example

fs.rm('/temp/*', FindOptions{recursive: true}, RemoveOptions{recursive: true, delete_blobs: true})!

fn (Fs) root_dir #

fn (mut self Fs) root_dir() !FsDir

fn (Fs) type_name #

fn (self Fs) type_name() string

struct FsArg #

@[params]
struct FsArg {
pub mut:
	name        string @[required]
	description string
	group_id    u32
	root_dir_id u32
	quota_bytes u64
	used_bytes  u64
	tags        []string
	messages    []db.MessageArg
}

struct FsBlob #

@[heap]
struct FsBlob {
	db.Base
pub mut:
	hash       string // blake192 hash of content
	data       []u8   // Binary data (max 1MB)
	size_bytes int    // Size in bytes
	created_at i64
	mime_type  string // MIME type
	encoding   string // Encoding type
}

FsBlob represents binary data up to 1MB

fn (FsBlob) type_name #

fn (self FsBlob) type_name() string

fn (FsBlob) description #

fn (self FsBlob) description(methodname string) string

return example rpc call and result for each methodname

fn (FsBlob) example #

fn (self FsBlob) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (FsBlob) dump #

fn (self FsBlob) dump(mut e encoder.Encoder) !

fn (FsBlob) calculate_hash #

fn (mut blob FsBlob) calculate_hash()

fn (FsBlob) verify_integrity #

fn (blob FsBlob) verify_integrity() bool

struct FsBlobArg #

@[params]
struct FsBlobArg {
pub mut:
	data       []u8 @[required]
	mime_type  string
	encoding   string
	created_at i64
}

struct FsBlobMembership #

@[heap]
struct FsBlobMembership {
pub mut:
	hash   string // blake192 hash of content (key)
	fsid   []u32  // list of fs ids where this blob is used
	blobid u32    // id of the blob
}

FsBlobMembership represents membership of a blob in one or more filesystems, the key is the hash of the blob

fn (FsBlobMembership) type_name #

fn (self FsBlobMembership) type_name() string

fn (FsBlobMembership) dump #

fn (self FsBlobMembership) dump(mut e encoder.Encoder) !

fn (FsBlobMembership) description #

fn (self FsBlobMembership) description(methodname string) string

fn (FsBlobMembership) example #

fn (self FsBlobMembership) example(methodname string) (string, string)

struct FsBlobMembershipArg #

@[params]
struct FsBlobMembershipArg {
pub mut:
	hash   string @[required]
	fsid   []u32  @[required]
	blobid u32    @[required]
}

struct FsDir #

@[heap]
struct FsDir {
	db.Base
pub mut:
	fs_id       u32 // Associated filesystem
	parent_id   u32 // Parent directory ID (0 for root)
	directories []u32
	files       []u32
	symlinks    []u32
}

FsDir represents a directory in a filesystem

fn (FsDir) type_name #

fn (self FsDir) type_name() string

fn (FsDir) dump #

fn (self FsDir) dump(mut e encoder.Encoder) !

fn (FsDir) description #

fn (self FsDir) description(methodname string) string

fn (FsDir) example #

fn (self FsDir) example(methodname string) (string, string)

struct FsDirArg #

@[params]
struct FsDirArg {
pub mut:
	name        string @[required]
	description string
	fs_id       u32 @[required]
	parent_id   u32
	tags        []string
	messages    []db.MessageArg
	directories []u32
	files       []u32
	symlinks    []u32
}

struct FsFile #

@[heap]
struct FsFile {
	db.Base
pub mut:
	fs_id       u32   // Associated filesystem
	directories []u32 // Directory IDs where this file exists
	blobs       []u32 // IDs of file content blobs
	size_bytes  u64
	mime_type   MimeType
	checksum    string // e.g., checksum of the file, needs to be calculated is blake 192
	accessed_at i64
	metadata    map[string]string // Custom metadata
}

FsFile represents a file in a filesystem

fn (FsFile) type_name #

fn (self FsFile) type_name() string

fn (FsFile) dump #

fn (self FsFile) dump(mut e encoder.Encoder) !

fn (FsFile) description #

fn (self FsFile) description(methodname string) string

fn (FsFile) example #

fn (self FsFile) example(methodname string) (string, string)

struct FsFileArg #

@[params]
struct FsFileArg {
pub mut:
	name        string @[required]
	description string
	fs_id       u32 @[required]
	directories []u32
	blobs       []u32
	size_bytes  u64
	mime_type   MimeType // Changed from string to MimeType enum
	checksum    string
	accessed_at i64
	metadata    map[string]string
	tags        []string
	messages    []db.MessageArg
}

struct FsListArg #

@[params]
struct FsListArg {
pub mut:
	group_id u32
	limit    int = 100 // Default limit is 100
}

fn (FsSymlink) type_name #

fn (self FsSymlink) type_name() string

fn (FsSymlink) dump #

fn (self FsSymlink) dump(mut e encoder.Encoder) !

fn (FsSymlink) description #

fn (self FsSymlink) description(methodname string) string

fn (FsSymlink) example #

fn (self FsSymlink) example(methodname string) (string, string)

struct FsSymlinkArg #

@[params]
struct FsSymlinkArg {
pub mut:
	name        string @[required]
	description string
	fs_id       u32               @[required]
	parent_id   u32               @[required]
	target_id   u32               @[required]
	target_type SymlinkTargetType @[required]
	tags        []string
	messages    []db.MessageArg
}

struct ImportOptions #

@[params]
struct ImportOptions {
pub mut:
	recursive     bool = true // Import directories recursively
	overwrite     bool // Overwrite existing files in VFS
	preserve_meta bool = true // Preserve file metadata (timestamps, etc.)
}

ImportOptions provides options for import operations

struct MoveOptions #

@[params]
struct MoveOptions {
pub mut:
	overwrite bool // Overwrite existing files at destination
}

MoveOptions provides options for move operations

struct RemoveOptions #

@[params]
struct RemoveOptions {
pub mut:
	recursive    bool // Remove directories recursively
	delete_blobs bool // Delete associated blobs (true) or keep them (false)
	force        bool // Force removal even if directory is not empty
}

RemoveOptions provides options for remove operations