コード例 #1
0
def cache(server, clear=False):
    cache = server.cache(ARGS.full)
    name = ['summary', 'full'][ARGS.full]
    files = cache.file_count()
    if not files:
        Log.error('No files in %s cache.' % name)

    elif clear:
        if not clear.strip() == 'clear':
            raise Exception("Don't understand 'clear %s'." % clear)
        if not ARGS.yes:
            yes = raw_input('OK to clear %s cache? (y/N) ' % name)
            if not yes.lower().startswith('y'):
                Log.out('Cancelled.')
                return
        cache.clear(ARGS.full)
        Log.out('%s cache cleared - %d file%s deleted.' %
                (name.capitalize(), files, '' if files == 1 else 's'))

    else:
        caches = (int(c) for c in cache.cache_list())
        Log.out(Range.to_string(caches))
コード例 #2
0
ファイル: Cache.py プロジェクト: CCJY/rippled
def cache(server, clear=False):
    cache = server.cache(ARGS.full)
    name = ['summary', 'full'][ARGS.full]
    files = cache.file_count()
    if not files:
        Log.error('No files in %s cache.' % name)

    elif clear:
        if not clear.strip() == 'clear':
            raise Exception("Don't understand 'clear %s'." % clear)
        if not ARGS.yes:
            yes = raw_input('OK to clear %s cache? (y/N) ' % name)
            if not yes.lower().startswith('y'):
                Log.out('Cancelled.')
                return
        cache.clear(ARGS.full)
        Log.out('%s cache cleared - %d file%s deleted.' %
                (name.capitalize(), files, '' if files == 1 else 's'))

    else:
        caches = (int(c) for c in cache.cache_list())
        Log.out(Range.to_string(caches))
コード例 #3
0
def info(server):
    Log.out('first =', server.first)
    Log.out('last =', server.last)
    Log.out('closed =', server.closed)
    Log.out('current =', server.current)
    Log.out('validated =', server.validated)
    Log.out('complete =', Range.to_string(server.complete))

    if ARGS.full:
        Log.out(pretty_print(server.info()))
コード例 #4
0
ファイル: Info.py プロジェクト: CCJY/rippled
def info(server):
    Log.out('first = ', server.first)
    Log.out('last = ', server.last)
    Log.out('closed =', server.closed)
    Log.out('current =', server.current)
    Log.out('validated =', server.validated)
    Log.out('complete =', Range.to_string(server.complete))

    if ARGS.full:
        Log.out(pretty_print(server.info()))