-- Tabla principal de inodos
CREATE TABLE inodes ( inode_id BIGSERIAL PRIMARY KEY, parent_id BIGINT REFERENCES inodes(inode_id), name TEXT NOT NULL, type CHAR(1) NOT NULL, -- 'f' archivo, 'd' directorio, 'l' symlink size BIGINT DEFAULT 0, mode INTEGER DEFAULT 493, -- 0755 en octal uid INTEGER DEFAULT 0, gid INTEGER DEFAULT 0, atime TIMESTAMPTZ DEFAULT NOW(), mtime TIMESTAMPTZ DEFAULT NOW(), ctime TIMESTAMPTZ DEFAULT NOW()
); -- Los datos reales van acá, particionados en bloques
CREATE TABLE blocks ( inode_id BIGINT REFERENCES inodes(inode_id) ON DELETE CASCADE, block_num INTEGER NOT NULL, data BYTEA NOT NULL, -- contenido binario real PRIMARY KEY (inode_id, block_num)
); -- Índice crítico — sin esto es inutilizable
CREATE INDEX idx_inodes_parent_name ON inodes(parent_id, name);
-- Tabla principal de inodos
CREATE TABLE inodes ( inode_id BIGSERIAL PRIMARY KEY, parent_id BIGINT REFERENCES inodes(inode_id), name TEXT NOT NULL, type CHAR(1) NOT NULL, -- 'f' archivo, 'd' directorio, 'l' symlink size BIGINT DEFAULT 0, mode INTEGER DEFAULT 493, -- 0755 en octal uid INTEGER DEFAULT 0, gid INTEGER DEFAULT 0, atime TIMESTAMPTZ DEFAULT NOW(), mtime TIMESTAMPTZ DEFAULT NOW(), ctime TIMESTAMPTZ DEFAULT NOW()
); -- Los datos reales van acá, particionados en bloques
CREATE TABLE blocks ( inode_id BIGINT REFERENCES inodes(inode_id) ON DELETE CASCADE, block_num INTEGER NOT NULL, data BYTEA NOT NULL, -- contenido binario real PRIMARY KEY (inode_id, block_num)
); -- Índice crítico — sin esto es inutilizable
CREATE INDEX idx_inodes_parent_name ON inodes(parent_id, name);
-- Tabla principal de inodos
CREATE TABLE inodes ( inode_id BIGSERIAL PRIMARY KEY, parent_id BIGINT REFERENCES inodes(inode_id), name TEXT NOT NULL, type CHAR(1) NOT NULL, -- 'f' archivo, 'd' directorio, 'l' symlink size BIGINT DEFAULT 0, mode INTEGER DEFAULT 493, -- 0755 en octal uid INTEGER DEFAULT 0, gid INTEGER DEFAULT 0, atime TIMESTAMPTZ DEFAULT NOW(), mtime TIMESTAMPTZ DEFAULT NOW(), ctime TIMESTAMPTZ DEFAULT NOW()
); -- Los datos reales van acá, particionados en bloques
CREATE TABLE blocks ( inode_id BIGINT REFERENCES inodes(inode_id) ON DELETE CASCADE, block_num INTEGER NOT NULL, data BYTEA NOT NULL, -- contenido binario real PRIMARY KEY (inode_id, block_num)
); -- Índice crítico — sin esto es inutilizable
CREATE INDEX idx_inodes_parent_name ON inodes(parent_id, name);
# Levantamos Postgres primero
docker run -d \ --name tigerfs-postgres \ -e POSTGRES_PASSWORD=tigerfs \ -e POSTGRES_DB=tigerfs \ -p 5432:5432 \ postgres:16 # Esperamos que levante de verdad
sleep 3 # Instalamos las dependencias de FUSE en el host
sudo apt-get install -y fuse libfuse-dev # Clonamos TigerFS
git clone https://github.com/[repo]/tigerfs
cd tigerfs # Build
make build # Creamos el punto de montaje
mkdir -p /tmp/tigerfs-mount # Montamos
./tigerfs mount \ --dsn "postgres://postgres:tigerfs@localhost:5432/tigerfs" \ --mountpoint /tmp/tigerfs-mount
# Levantamos Postgres primero
docker run -d \ --name tigerfs-postgres \ -e POSTGRES_PASSWORD=tigerfs \ -e POSTGRES_DB=tigerfs \ -p 5432:5432 \ postgres:16 # Esperamos que levante de verdad
sleep 3 # Instalamos las dependencias de FUSE en el host
sudo apt-get install -y fuse libfuse-dev # Clonamos TigerFS
git clone https://github.com/[repo]/tigerfs
cd tigerfs # Build
make build # Creamos el punto de montaje
mkdir -p /tmp/tigerfs-mount # Montamos
./tigerfs mount \ --dsn "postgres://postgres:tigerfs@localhost:5432/tigerfs" \ --mountpoint /tmp/tigerfs-mount
# Levantamos Postgres primero
docker run -d \ --name tigerfs-postgres \ -e POSTGRES_PASSWORD=tigerfs \ -e POSTGRES_DB=tigerfs \ -p 5432:5432 \ postgres:16 # Esperamos que levante de verdad
sleep 3 # Instalamos las dependencias de FUSE en el host
sudo apt-get install -y fuse libfuse-dev # Clonamos TigerFS
git clone https://github.com/[repo]/tigerfs
cd tigerfs # Build
make build # Creamos el punto de montaje
mkdir -p /tmp/tigerfs-mount # Montamos
./tigerfs mount \ --dsn "postgres://postgres:tigerfs@localhost:5432/tigerfs" \ --mountpoint /tmp/tigerfs-mount
# Escribimos algo
echo "hola tigerfs" > /tmp/tigerfs-mount/test.txt # Verificamos que realmente está en Postgres
psql -h localhost -U postgres tigerfs -c " SELECT i.name, i.size, encode(b.data, 'escape') as contenido FROM inodes i JOIN blocks b ON i.inode_id = b.inode_id WHERE i.name = 'test.txt';
" -- Resultado:
-- name | size | contenido
-- ---------+------+------------------
-- test.txt| 14 | hola tigerfs\012
# Escribimos algo
echo "hola tigerfs" > /tmp/tigerfs-mount/test.txt # Verificamos que realmente está en Postgres
psql -h localhost -U postgres tigerfs -c " SELECT i.name, i.size, encode(b.data, 'escape') as contenido FROM inodes i JOIN blocks b ON i.inode_id = b.inode_id WHERE i.name = 'test.txt';
" -- Resultado:
-- name | size | contenido
-- ---------+------+------------------
-- test.txt| 14 | hola tigerfs\012
# Escribimos algo
echo "hola tigerfs" > /tmp/tigerfs-mount/test.txt # Verificamos que realmente está en Postgres
psql -h localhost -U postgres tigerfs -c " SELECT i.name, i.size, encode(b.data, 'escape') as contenido FROM inodes i JOIN blocks b ON i.inode_id = b.inode_id WHERE i.name = 'test.txt';
" -- Resultado:
-- name | size | contenido
-- ---------+------+------------------
-- test.txt| 14 | hola tigerfs\012
# Esto falla silenciosamente sin el flag correcto
docker run --device /dev/fuse --cap-add SYS_ADMIN tigerfs-image
# Esto falla silenciosamente sin el flag correcto
docker run --device /dev/fuse --cap-add SYS_ADMIN tigerfs-image
# Esto falla silenciosamente sin el flag correcto
docker run --device /dev/fuse --cap-add SYS_ADMIN tigerfs-image