Пример #1
0
    How to change error level:
        import logging
        logger = logging.getLogger('fs.debugfs')
        logger.setLevel(logging.CRITICAL)
        fs = DebugFS(OSFS('~')
        print fs.listdir('.')

'''
import logging
from logging import DEBUG, INFO, ERROR, CRITICAL
import sys

import fs
from fs.errors import FSError

logger = fs.getLogger('fs.debugfs')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())

class DebugFS(object):
    def __init__(self, fs, identifier=None, skip=(), verbose=True):
        '''
            fs - Reference to object to debug
            identifier - Custom string-like object will be added
                to each log line as identifier.
            skip - list of method names which DebugFS should not log
        '''
        self.__wrapped_fs = fs
        self.__identifier = identifier
        self.__skip = skip
        self.__verbose = verbose
Пример #2
0
from logging import DEBUG, INFO, ERROR, CRITICAL

import fs
import fs.errors as errors
from fs.path import abspath, relpath, normpath, dirname, pathjoin
from fs.base import FS, NullFile
from fs import _thread_synchronize_default, SEEK_END
from fs.remote import CacheFSMixin, RemoteFileBuffer
from fs.base import fnmatch, NoDefaultMeta

from util import TahoeUtil
from connection import Connection   

from six import b

logger = fs.getLogger('fs.tahoelafs')

def _fix_path(func):
    """Method decorator for automatically normalising paths."""
    def wrapper(self, *args, **kwds):
        if len(args):
            args = list(args)
            args[0] = _fixpath(args[0])
        return func(self, *args, **kwds)
    return wrapper


def _fixpath(path):
    """Normalize the given path."""
    return abspath(normpath(path))
    
Пример #3
0
    How to change error level:
        import logging
        logger = logging.getLogger('fs.debugfs')
        logger.setLevel(logging.CRITICAL)
        fs = DebugFS(OSFS('~')
        print fs.listdir('.')
    
'''
import logging
from logging import DEBUG, INFO, ERROR, CRITICAL
import sys

import fs
from fs.errors import FSError

logger = fs.getLogger('fs.debugfs')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())

class DebugFS(object):
    def __init__(self, fs, identifier=None, skip=(), verbose=True):
        '''
            fs - Reference to object to debug
            identifier - Custom string-like object will be added
                to each log line as identifier.
            skip - list of method names which DebugFS should not log
        '''        
        self.__wrapped_fs = fs
        self.__identifier = identifier
        self.__skip = skip
        self.__verbose = verbose 
Пример #4
0
import datetime
import cookielib
import fnmatch
import xml.dom.pulldom

import fs
from fs.base import *
from fs.path import *
from fs.errors import *
from fs.remote import RemoteFileBuffer

from fs.contrib.davfs.util import *
from fs.contrib.davfs import xmlobj
from fs.contrib.davfs.xmlobj import *

logger = fs.getLogger("fs.contrib.davfs")

import errno
_RETRYABLE_ERRORS = [errno.EADDRINUSE]
try:
    _RETRYABLE_ERRORS.append(errno.ECONNRESET)
    _RETRYABLE_ERRORS.append(errno.ECONNABORTED)
except AttributeError:
    _RETRYABLE_ERRORS.append(104)



class DAVFS(FS):
    """Access a remote filesystem via WebDAV.

    This FS implementation provides access to a remote filesystem via the
Пример #5
0
from logging import DEBUG, INFO, ERROR, CRITICAL

import fs
import fs.errors as errors
from fs.path import abspath, relpath, normpath, dirname, pathjoin
from fs.base import FS, NullFile
from fs import _thread_synchronize_default, SEEK_END
from fs.remote import CacheFSMixin, RemoteFileBuffer
from fs.base import fnmatch, NoDefaultMeta

from util import TahoeUtil
from connection import Connection

from six import b

logger = fs.getLogger("fs.tahoelafs")


def _fix_path(func):
    """Method decorator for automatically normalising paths."""

    def wrapper(self, *args, **kwds):
        if len(args):
            args = list(args)
            args[0] = _fixpath(args[0])
        return func(self, *args, **kwds)

    return wrapper


def _fixpath(path):
Пример #6
0
import datetime
import cookielib
import fnmatch
import xml.dom.pulldom

import fs
from fs.base import *
from fs.path import *
from fs.errors import *
from fs.remote import RemoteFileBuffer

from fs.contrib.davfs.util import *
from fs.contrib.davfs import xmlobj
from fs.contrib.davfs.xmlobj import *

logger = fs.getLogger("fs.contrib.davfs")

import errno
_RETRYABLE_ERRORS = [errno.EADDRINUSE]
try:
    _RETRYABLE_ERRORS.append(errno.ECONNRESET)
    _RETRYABLE_ERRORS.append(errno.ECONNABORTED)
except AttributeError:
    _RETRYABLE_ERRORS.append(104)


class DAVFS(FS):
    """Access a remote filesystem via WebDAV.

    This FS implementation provides access to a remote filesystem via the
    WebDAV protocol.  Basic Level 1 WebDAV is supported; locking is not
Пример #7
0
'''
2015 John Ko
This mounts a CCASFS with FUSE
'''

from ccasfs import CCASFS
from logging import DEBUG, INFO, ERROR, CRITICAL
import fs
from fs.expose import fuse

logger = fs.getLogger('fs.ccasfs')
logger.setLevel(DEBUG)

ccasfs = CCASFS( [
            "/scratch/ccasfs/chunks/"
        ],
        "/scratch/ccasfs/meta/manifest",
        "/scratch/ccasfs/meta/index",
        "/scratch/ccasfs/meta/catalog",
        "/scratch/ccasfs/tmp",
        write_algorithm="mirror",
        debug=2)

mountpoint = fuse.mount(ccasfs, "/mnt", foreground=True, fsname="ccasfs")