Package fcp :: Module freenetfs :: Class FreenetBaseFS
[hide private]
[frames] | no frames]

Class FreenetBaseFS

source code

Known Subclasses:

Instance Methods [hide private]
 
__init__(self, mountpoint, *args, **kw)
Create a freenetfs
source code
 
executeCommand(self, cmd)
Executes a single-line command that was submitted as a base64-encoded filename in /cmds/
source code
 
cmd_hello(self, *args) source code
 
cmd_mount(self, *args)
tries to mount a freedisk
source code
 
cmd_umount(self, *args)
tries to unmount a freedisk
source code
 
cmd_update(self, *args)
Does an update of a freedisk from freenet
source code
 
cmd_commit(self, *args)
Does an commit of a freedisk into freenet
source code
 
chmod(self, path, mode) source code
 
chown(self, path, user, group) source code
 
fsync(self, path, isfsyncfile) source code
 
getattr(self, path) source code
 
getdir(self, path) source code
 
link(self, path, path1) source code
 
mkdir(self, path, mode) source code
 
mknod(self, path, mode, dev)
Python has no os.mknod, so we can only do some things
source code
 
open(self, path, flags) source code
 
read(self, path, length, offset) source code
 
readlink(self, path) source code
 
release(self, path, flags) source code
 
rename(self, path, path1) source code
 
rmdir(self, path) source code
 
statfs(self)
Should return a tuple with the following 6 elements:
source code
 
symlink(self, path, path1) source code
 
truncate(self, path, size) source code
 
unlink(self, path) source code
 
utime(self, path, times) source code
 
write(self, path, buf, off) source code
 
setupFreedisks(self)
Initialises the freedisks
source code
 
addDisk(self, name, uri, passwd)
Adds (mounts) a freedisk within freenetfs
source code
 
delDisk(self, name)
drops a freedisk mount
source code
 
commitDisk(self, name)
synchronises a freedisk TO freenet
source code
 
updateDisk(self, name)
synchronises a freedisk FROM freenet
source code
 
getManifest(self, name)
Retrieves the manifest of a given disk
source code
 
putManifest(self, name)
Inserts a freedisk manifest into freenet
source code
 
setupFiles(self)
Create initial file/directory layout, according to attributes 'initialFiles' and 'chrFiles'
source code
 
connectToNode(self)
Attempts a connection to an fcp node
source code
 
mythread(self)
The beauty of the FUSE python implementation is that with the python interp running in foreground, you can have threads
source code
 
hashpath(self, path) source code
 
addToCache(self, rec=None, **kw)
Tries to 'cache' a given file/dir record, and adds it to parent dir
source code
 
delFromCache(self, rec)
Tries to remove file/dir record from cache
source code
 
statFromKw(self, **kw)
Constructs a stat tuple from keywords
source code
 
statToDict(self, info)
Converts a tuple returned by a stat call into a dict with keys:
source code
 
getReadURI(self, path)
Converts to a pathname to a freenet URI for insertion, using public key
source code
 
getWriteURI(self, path)
Converts to a pathname to a freenet URI for insertion, using private key if any
source code
 
log(self, msg) source code
 
__getDirStat(self, path)
returns a stat tuple for given path
source code
 
_loadConfig(self)
The 'physical device' argument to mount should be the pathname of a configuration file, with 'name=val' lines, including the following items:
source code
Class Variables [hide private]
  multithreaded = 0
  flags = 1
  debug = False
  fcpHost = '127.0.0.1'
  fcpPort = 9481
  verbosity = 5
  allow_other = False
  kernel_cache = False
  config = '/home/arne/.freediskrc'
  initialFiles = ['/', '/get/', '/put/', '/keys/', '/usr/', '/cm...
  chrFiles = []
Method Details [hide private]

__init__(self, mountpoint, *args, **kw)
(Constructor)

source code 

Create a freenetfs

Arguments:

  • mountpoint - the dir in the filesystem at which to mount the fs
  • other args get passed to fuse

Keywords:

  • multithreaded - whether to run the fs multithreaded, default True
  • fcpHost - hostname of FCP service
  • fcpPort - port number of FCP service
  • verbosity - defaults to fcp.DETAIL
  • config - location of config file
  • debug - whether to run in debug mode, default False

cmd_mount(self, *args)

source code 

tries to mount a freedisk

arguments:

  • diskname
  • uri (may be public or private)
  • password

cmd_umount(self, *args)

source code 

tries to unmount a freedisk

arguments:

  • diskname

statfs(self)

source code 

Should return a tuple with the following 6 elements:

  • blocksize - size of file blocks, in bytes
  • totalblocks - total number of blocks in the filesystem
  • freeblocks - number of free blocks
  • totalfiles - total number of file inodes
  • freefiles - nunber of free file inodes

Feel free to set any of the above values to 0, which tells the kernel that the info is not available.

addDisk(self, name, uri, passwd)

source code 

Adds (mounts) a freedisk within freenetfs

Arguments:

  • name - name of disk - will be mounted in as /usr/<name>
  • uri - a public or private SSK key URI. Parsing of the key will reveal whether it's public or private. If public, the freedisk will be mounted read-only. If private, the freedisk will be mounted read/write
  • passwd - the encryption password for the disk, or empty string if the disk is to be unencrypted

delDisk(self, name)

source code 

drops a freedisk mount

Arguments:

  • name - the name of the disk

commitDisk(self, name)

source code 

synchronises a freedisk TO freenet

Arguments:

  • name - the name of the disk

updateDisk(self, name)

source code 

synchronises a freedisk FROM freenet

Arguments:

  • name - the name of the disk

statToDict(self, info)

source code 

Converts a tuple returned by a stat call into a dict with keys:

  • isdir
  • ischr
  • isblk
  • isreg
  • isfifo
  • islnk
  • issock
  • mode
  • inode
  • dev
  • nlink
  • uid
  • gid
  • size
  • atime
  • mtime
  • ctime

_loadConfig(self)

source code 

The 'physical device' argument to mount should be the pathname of a configuration file, with 'name=val' lines, including the following items:

  • publickey=<freenet public key URI>
  • privatekey=<freenet private key URI> (optional, without which we will have the fs mounted readonly

Class Variable Details [hide private]

initialFiles

Value:
['/', '/get/', '/put/', '/keys/', '/usr/', '/cmds/']