示例#1
0
def main():
    options, args = parser.parse_args()

    if not args:
        return parser.print_usage()

    elif args[0] == 'mkfs':
        if len(args) != 2:
            return parser.print_usage()
        storage.GitStorage.create(args[1])

    elif args[0] == 'mount':
        if len(args) != 3:
            return parser.print_usage()
        repo_path, mount_path = args[1:]
        print "mounting %r at %r" % (repo_path, mount_path)
        filesystem.mount(repo_path, mount_path, loglevel=options.loglevel)

    elif args[0] == 'fsck':
        if len(args) != 2:
            return parser.print_usage()
        storage.fsck(args[1], sys.stdout)

    elif args[0] == 'upgrade':
        if len(args) != 2:
            return parser.print_usage()
        handler = logging.StreamHandler()
        handler.setLevel(options.loglevel)
        logging.getLogger('spaghettifs.storage.upgrade').addHandler(handler)
        for run_update in storage.all_updates:
            run_update(args[1])

    else:
        return parser.print_usage()
示例#2
0
文件: cmd.py 项目: zsaur/SpaghettiFS
def main():
    options, args = parser.parse_args()

    if not args:
        return parser.print_usage()

    elif args[0] == 'mkfs':
        if len(args) != 2:
            return parser.print_usage()
        storage.GitStorage.create(args[1])

    elif args[0] == 'mount':
        if len(args) != 3:
            return parser.print_usage()
        repo_path, mount_path = args[1:]
        print "mounting %r at %r" % (repo_path, mount_path)
        filesystem.mount(repo_path, mount_path, loglevel=options.loglevel)

    elif args[0] == 'fsck':
        if len(args) != 2:
            return parser.print_usage()
        storage.fsck(args[1], sys.stdout)

    elif args[0] == 'upgrade':
        if len(args) != 2:
            return parser.print_usage()
        handler = logging.StreamHandler()
        handler.setLevel(options.loglevel)
        logging.getLogger('spaghettifs.storage.upgrade').addHandler(handler)
        for run_update in storage.all_updates:
            run_update(args[1])

    else:
        return parser.print_usage()
示例#3
0
def fs_mount(repo_path, mount_path, stats_queue):
    log_watcher = LogWatcher()
    time0 = time.time()
    clock0 = time.clock()
    filesystem.mount(repo_path, mount_path)
    stats = {'time': time.time() - time0, 'clock': time.clock() - clock0}
    stats.update(log_watcher.report())
    stats_queue.put(stats)
示例#4
0
def fs_mount(repo_path, mount_path, stats_queue):
    log_watcher = LogWatcher()
    time0 = time.time()
    clock0 = time.clock()
    filesystem.mount(repo_path, mount_path)
    stats = {'time': time.time() - time0,
             'clock': time.clock() - clock0}
    stats.update(log_watcher.report())
    stats_queue.put(stats)