Module erlfs_db

Provides an interface to the Mnesia metadata store.

Copyright © 2008 Jacob Torrey

Authors: Jacob Torrey (torreyji@clarkson.edu).

Description

Provides an interface to the Mnesia metadata store

Function Index

add_nodeinfo/3Adds Node to the node info metadata store.
add_replication_row/3Adds a row to the replication table.
create/8Creates a file in the metadata store.
file_exists/1Checks whether the Fid points to a valid file.
format/0Formats the Mnesia database and creates the tables.
get_fid/2Returns a filename's Fid.
get_nodes/1Returns a list of nodes which have an up to date version of Fid.
has_files/1Returns true if the replication table says that Node still has files.
ls/1Lists all files in a directory.
replicate/1Replicates the tables from the passed node to the current Mnesia database.
start/0Starts the Mnesia metadata store.
stop/0Stops the Mnesia metadata store.
try_delnodeinfo/1Tries to delete Node from the nodeinfo table in Mnesia.
try_replicate/1Tries to replicate as many of Node's files as possible.

Function Details

add_nodeinfo/3

add_nodeinfo(Node::atom(), Totalspace::int(), Usedspace::int()) -> {atomic, Result} | {aborted, Reason}

Adds Node to the node info metadata store

add_replication_row/3

add_replication_row(Node::atom(), Fid::int(), MD5::binary()) -> {atomic, Result} | {aborted, Reason}

Adds a row to the replication table

create/8

create(Filename::list(), Dir::atom(), Fid::int(), Owner::atom(), Group::atom(), Permissions::int(), Size::int(), MD5::binary()) -> {atomic, Result} | {aborted, Reason}

Creates a file in the metadata store

file_exists/1

file_exists(Fid::int()) -> bool()

Checks whether the Fid points to a valid file

format/0

format() -> ok | {error, Reason}

Formats the Mnesia database and creates the tables

get_fid/2

get_fid(Filename::atom(), Dir::atom()) -> int()

Returns a filename's Fid

get_nodes/1

get_nodes(Fid::int()) -> list()

Returns a list of nodes which have an up to date version of Fid

has_files/1

has_files(Node::atom()) -> bool()

Returns true if the replication table says that Node still has files

ls/1

ls(Dir::atom()) -> list()

Lists all files in a directory

replicate/1

replicate(Node::atom()) -> ok | {timeout, BadTabList} | {error, Reason}

Replicates the tables from the passed node to the current Mnesia database

start/0

start() -> ok | {error, Reason}

Starts the Mnesia metadata store

stop/0

stop() -> ok | {error, Reason}

Stops the Mnesia metadata store

try_delnodeinfo/1

try_delnodeinfo(Node::atom()) -> {atomic, Result} | {aborted, Reason}

Tries to delete Node from the nodeinfo table in Mnesia

try_replicate/1

try_replicate(Node::atom()) -> ok

Tries to replicate as many of Node's files as possible


Generated by EDoc, Mar 17 2008, 11:36:20.