OpenStack Study: swift
OpenStack Index
\OpenStack\swift-2014.1\swift\account\auditor.py
class AccountAuditor(Daemon):
def __init__(self, conf):
def _one_audit_pass(self, reported):
def run_forever(self, *args, **kwargs):
def run_once(self, *args, **kwargs):
def account_audit(self, path):
\OpenStack\swift-2014.1\swift\account\backend.py
class AccountBroker(DatabaseBroker):
def _initialize(self, conn, put_timestamp):
def create_container_table(self, conn):
def create_account_stat_table(self, conn, put_timestamp):
def get_db_version(self, conn):
def _delete_db(self, conn, timestamp, force=False):
def _commit_puts_load(self, item_list, entry):
def empty(self):
def put_container(self, name, put_timestamp, delete_timestamp, object_count, bytes_used):
def is_deleted(self):
def is_status_deleted(self):
def get_info(self):
def list_containers_iter(self, limit, marker, end_marker, prefix, delimiter):
def merge_items(self, item_list, source=None):
\OpenStack\swift-2014.1\swift\account\reaper.py
class AccountReaper(Daemon):
def __init__(self, conf):
def get_account_ring(self):
def get_container_ring(self):
def get_object_ring(self):
def run_forever(self, *args, **kwargs):
def run_once(self, *args, **kwargs):
def reap_device(self, device):
def reap_account(self, broker, partition, nodes):
def reap_container(self, account, account_partition, account_nodes, container):
def reap_object(self, account, container, container_partition, container_nodes, obj):
\OpenStack\swift-2014.1\swift\account\replicator.py
class AccountReplicator(db_replicator.Replicator):
\OpenStack\swift-2014.1\swift\account\server.py
class AccountController(object):
def __init__(self, conf, logger=None):
def _get_account_broker(self, drive, part, account, **kwargs):
def _deleted_response(self, broker, req, resp, body=''):
def DELETE(self, req):
def PUT(self, req):
def HEAD(self, req):
def GET(self, req):
def REPLICATE(self, req):
def POST(self, req):
def __call__(self, env, start_response):
def app_factory(global_conf, **local_conf):
\OpenStack\swift-2014.1\swift\account\utils.py
class FakeAccountBroker(object):
def get_info(self):
def list_containers_iter(self, *_, **__):
def metadata(self):
def account_listing_response(account, req, response_content_type, broker=None, limit='', marker='', end_marker='', prefix='', delimiter=''):
\OpenStack\swift-2014.1\swift\account\__init__.py
\OpenStack\swift-2014.1\swift\cli\info.py
class InfoSystemExit(Exception):
def print_ring_locations(ring, datadir, account, container=None):
def print_db_info_metadata(db_type, info, metadata):
def print_info(db_type, db_file, swift_dir='/etc/swift'):
\OpenStack\swift-2014.1\swift\cli\recon.py
def seconds2timeunit(seconds):
def size_suffix(size):
class Scout(object):
def __init__(self, recon_type, verbose=False, suppress_errors=False, timeout=5):
def scout_host(self, base_url, recon_type):
def scout(self, host):
class SwiftRecon(object):
def __init__(self):
def _gen_stats(self, stats, name=None):
def _print_stats(self, stats):
def _ptime(self, timev=None):
def get_devices(self, zone_filter, swift_dir, ring_name):
def get_ringmd5(self, hosts, ringfile):
def async_check(self, hosts):
def umount_check(self, hosts):
def expirer_check(self, hosts):
def replication_check(self, hosts):
def object_replication_check(self, hosts):
def updater_check(self, hosts):
def auditor_check(self, hosts):
def nested_get_value(self, key, recon_entry):
def object_auditor_check(self, hosts):
def load_check(self, hosts):
def quarantine_check(self, hosts):
def socket_usage(self, hosts):
def disk_usage(self, hosts, top=0, human_readable=False):
def main(self):
def main():
\OpenStack\swift-2014.1\swift\cli\ringbuilder.py
def format_device(dev):
def _parse_add_values(argvish):
class Commands(object):
def unknown():
def create():
def default():
def search():
def list_parts():
def add():
def set_weight():
def set_info():
def remove():
def rebalance():
def get_seed(index):
def validate():
def write_ring():
def write_builder():
def pretend_min_part_hours_passed():
def set_min_part_hours():
def set_replicas():
def main(arguments=None):
\OpenStack\swift-2014.1\swift\cli\__init__.py
\OpenStack\swift-2014.1\swift\common\bufferedhttp.py
class BufferedHTTPResponse(HTTPResponse):
def __init__(self, sock, debuglevel=0, strict=0, method=None):
def expect_response(self):
def nuke_from_orbit(self):
def close(self):
class BufferedHTTPConnection(HTTPConnection):
def connect(self):
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
def getexpect(self):
def getresponse(self):
def http_connect(ipaddr, port, device, partition, method, path, headers=None, query_string=None, ssl=False):
def http_connect_raw(ipaddr, port, method, path, headers=None, query_string=None, ssl=False):
\OpenStack\swift-2014.1\swift\common\constraints.py
def reload_constraints():
def check_metadata(req, target_type):
def check_object_creation(req, object_name):
def check_mount(root, drive):
def check_float(string):
def check_utf8(string):
def check_copy_from_header(req):
\OpenStack\swift-2014.1\swift\common\container_sync_realms.py
class ContainerSyncRealms(object):
def __init__(self, conf_path, logger):
def reload(self):
def _reload(self):
def realms(self):
def key(self, realm):
def key2(self, realm):
def clusters(self, realm):
def endpoint(self, realm, cluster):
def get_sig(self, request_method, path, x_timestamp, nonce, realm_key, user_key):
\OpenStack\swift-2014.1\swift\common\daemon.py
class Daemon(object):
def __init__(self, conf):
def run_once(self, *args, **kwargs):
def run_forever(self, *args, **kwargs):
def run(self, once=False, **kwargs):
def kill_children(*args):
\OpenStack\swift-2014.1\swift\common\db.py
def utf8encode(*args):
def utf8encodekeys(metadata):
def _db_timeout(timeout, db_file, call):
class DatabaseConnectionError(sqlite3.DatabaseError):
def __init__(self, path, msg, timeout=0):
def __str__(self):
class DatabaseAlreadyExists(sqlite3.DatabaseError):
def __init__(self, path):
def __str__(self):
class GreenDBConnection(sqlite3.Connection):
def __init__(self, database, timeout=None, *args, **kwargs):
def cursor(self, cls=None):
def commit(self):
class GreenDBCursor(sqlite3.Cursor):
def __init__(self, *args, **kwargs):
def execute(self, *args, **kwargs):
def dict_factory(crs, row):
def chexor(old, name, timestamp):
def get_db_connection(path, timeout=30, okay_to_create=False):
class DatabaseBroker(object):
def __init__(self, db_file, timeout=BROKER_TIMEOUT, logger=None, account=None, container=None, pending_timeout=None, stale_reads_ok=False):
def __str__(self):
def initialize(self, put_timestamp=None):
def delete_db(self, timestamp):
def possibly_quarantine(self, exc_type, exc_value, exc_traceback):
def get(self):
def lock(self):
def newid(self, remote_id):
def _newid(self, conn):
def merge_timestamps(self, created_at, put_timestamp, delete_timestamp):
def get_items_since(self, start, count):
def get_sync(self, id, incoming=True):
def get_syncs(self, incoming=True):
def get_replication_info(self):
def _commit_puts(self, item_list=None):
def _commit_puts_stale_ok(self):
def _commit_puts_load(self, item_list, entry):
def merge_syncs(self, sync_points, incoming=True):
def _preallocate(self):
def prealloc_points():
def metadata(self):
def update_metadata(self, metadata_updates):
def reclaim(self, age_timestamp, sync_timestamp):
def _reclaim(self, conn, timestamp):
def update_put_timestamp(self, timestamp):
\OpenStack\swift-2014.1\swift\common\db_replicator.py
def quarantine_db(object_file, server_type):
def roundrobin_datadirs(datadirs):
def walk_datadir(datadir, node_id):
class ReplConnection(BufferedHTTPConnection):
def __init__(self, node, partition, hash_, logger):
def replicate(self, *args):
class Replicator(Daemon):
def __init__(self, conf):
def _zero_stats(self):
def _report_stats(self):
def _rsync_file(self, db_file, remote_file, whole_file=True):
def _rsync_db(self, broker, device, http, local_id, replicate_method='complete_rsync', replicate_timeout=None):
def _usync_db(self, point, broker, http, remote_id, local_id):
def _in_sync(self, rinfo, info, broker, local_sync):
def _http_connect(self, node, partition, db_file):
def _repl_to_node(self, node, broker, partition, info):
def _replicate_object(self, partition, object_file, node_id):
def delete_db(self, object_file):
def extract_device(self, object_file):
def report_up_to_date(self, full_info):
def run_once(self, *args, **kwargs):
def run_forever(self, *args, **kwargs):
class ReplicatorRpc(object):
def __init__(self, root, datadir, broker_class, mount_check=True, logger=None):
def dispatch(self, replicate_args, args):
def sync(self, broker, args):
def merge_syncs(self, broker, args):
def merge_items(self, broker, args):
def complete_rsync(self, drive, db_file, args):
def rsync_then_merge(self, drive, db_file, args):
\OpenStack\swift-2014.1\swift\common\direct_client.py
def _get_direct_account_container(path, stype, node, part, account, marker=None, limit=None, prefix=None, delimiter=None, conn_timeout=5, response_timeout=15):
def gen_headers(hdrs_in=None, add_ts=False):
def direct_get_account(node, part, account, marker=None, limit=None, prefix=None, delimiter=None, conn_timeout=5, response_timeout=15):
def direct_head_container(node, part, account, container, conn_timeout=5, response_timeout=15):
def direct_get_container(node, part, account, container, marker=None, limit=None, prefix=None, delimiter=None, conn_timeout=5, response_timeout=15):
def direct_delete_container(node, part, account, container, conn_timeout=5, response_timeout=15, headers=None):
def direct_head_object(node, part, account, container, obj, conn_timeout=5, response_timeout=15):
def direct_get_object(node, part, account, container, obj, conn_timeout=5, response_timeout=15, resp_chunk_size=None, headers=None):
def direct_put_object(node, part, account, container, name, contents, content_length=None, etag=None, content_type=None, headers=None, conn_timeout=5, response_timeout=15, chunk_size=65535):
def direct_post_object(node, part, account, container, name, headers, conn_timeout=5, response_timeout=15):
def direct_delete_object(node, part, account, container, obj, conn_timeout=5, response_timeout=15, headers=None):
def retry(func, *args, **kwargs):
\OpenStack\swift-2014.1\swift\common\exceptions.py
class MessageTimeout(Timeout):
def __init__(self, seconds=None, msg=None):
def __str__(self):
class SwiftException(Exception):
class DiskFileError(SwiftException):
class DiskFileNotOpen(DiskFileError):
class DiskFileQuarantined(DiskFileError):
class DiskFileCollision(DiskFileError):
class DiskFileNotExist(DiskFileError):
class DiskFileDeleted(DiskFileNotExist):
def __init__(self, metadata=None):
class DiskFileExpired(DiskFileDeleted):
class DiskFileNoSpace(DiskFileError):
class DiskFileDeviceUnavailable(DiskFileError):
class PathNotDir(OSError):
class ChunkReadTimeout(Timeout):
class ChunkWriteTimeout(Timeout):
class ConnectionTimeout(Timeout):
class DriveNotMounted(SwiftException):
class LockTimeout(MessageTimeout):
class RingBuilderError(SwiftException):
class RingValidationError(RingBuilderError):
class EmptyRingError(RingBuilderError):
class DuplicateDeviceError(RingBuilderError):
class ListingIterError(SwiftException):
class ListingIterNotFound(ListingIterError):
class ListingIterNotAuthorized(ListingIterError):
def __init__(self, aresp):
class SegmentError(SwiftException):
class ReplicationException(Exception):
class ReplicationLockTimeout(LockTimeout):
class ClientException(Exception):
def __init__(self, msg, http_scheme='', http_host='', http_port='', http_path='', http_query='', http_status=0, http_reason='', http_device='', http_response_content=''):
def __str__(self):
\OpenStack\swift-2014.1\swift\common\http.py
def is_informational(status):
def is_success(status):
def is_redirection(status):
def is_client_error(status):
def is_server_error(status):
\OpenStack\swift-2014.1\swift\common\internal_client.py
class UnexpectedResponse(Exception):
def __init__(self, message, resp):
class CompressingFileReader(object):
def __init__(self, file_obj, compresslevel=9, chunk_size=4096):
def set_initial_state(self):
def read(self, *a, **kw):
def __iter__(self):
def next(self):
def seek(self, offset, whence=0):
class InternalClient(object):
def __init__(self, conf_path, user_agent, request_tries, allow_modify_pipeline=False):
def make_request( self, method, path, headers, acceptable_statuses, body_file=None):
def _get_metadata( self, path, metadata_prefix='', acceptable_statuses=(2,)):
def _iter_items( self, path, marker='', end_marker='', acceptable_statuses=(2, HTTP_NOT_FOUND)):
def make_path(self, account, container=None, obj=None):
def _set_metadata( self, path, metadata, metadata_prefix='', acceptable_statuses=(2,)):
def iter_containers( self, account, marker='', end_marker='', acceptable_statuses=(2, HTTP_NOT_FOUND)):
def get_account_info( self, account, acceptable_statuses=(2, HTTP_NOT_FOUND)):
def get_account_metadata( self, account, metadata_prefix='', acceptable_statuses=(2,)):
def set_account_metadata( self, account, metadata, metadata_prefix='', acceptable_statuses=(2,)):
def container_exists(self, account, container):
def create_container( self, account, container, headers=None, acceptable_statuses=(2,)):
def delete_container( self, account, container, acceptable_statuses=(2, HTTP_NOT_FOUND)):
def get_container_metadata( self, account, container, metadata_prefix='', acceptable_statuses=(2,)):
def iter_objects( self, account, container, marker='', end_marker='', acceptable_statuses=(2, HTTP_NOT_FOUND)):
def set_container_metadata( self, account, container, metadata, metadata_prefix='', acceptable_statuses=(2,)):
def delete_object( self, account, container, obj, acceptable_statuses=(2, HTTP_NOT_FOUND)):
def get_object_metadata( self, account, container, obj, metadata_prefix='', acceptable_statuses=(2,)):
def iter_object_lines( self, account, container, obj, headers=None, acceptable_statuses=(2,)):
def set_object_metadata( self, account, container, obj, metadata, metadata_prefix='', acceptable_statuses=(2,)):
def upload_object( self, fobj, account, container, obj, headers=None):
def get_auth(url, user, key, auth_version='1.0', **kwargs):
class SimpleClient(object):
def __init__(self, url=None, token=None, starting_backoff=1, max_backoff=5, retries=5):
def base_request(self, method, container=None, name=None, prefix=None, headers={}, proxy=None, contents=None, full_listing=None):
def retry_request(self, method, **kwargs):
def get_account(self, *args, **kwargs):
def put_container(self, container, **kwargs):
def get_container(self, container, **kwargs):
def put_object(self, container, name, contents, **kwargs):
def put_object(url, **kwargs):
def delete_object(url, **kwargs):
\OpenStack\swift-2014.1\swift\common\manager.py
def setup_env():
def command(func):
def wrapped(*a, **kw):
def watch_server_pids(server_pids, interval=1, **kwargs):
class UnknownCommandError(Exception):
class Manager(object):
def __init__(self, servers, run_dir=RUN_DIR):
def __iter__(self):
def status(self, **kwargs):
def start(self, **kwargs):
def no_wait(self, **kwargs):
def no_daemon(self, **kwargs):
def once(self, **kwargs):
def stop(self, **kwargs):
def kill(self, **kwargs):
def shutdown(self, **kwargs):
def restart(self, **kwargs):
def reload(self, **kwargs):
def force_reload(self, **kwargs):
def get_command(self, cmd):
def list_commands(cls):
def run_command(self, cmd, **kwargs):
class Server(object):
def __init__(self, server, run_dir=RUN_DIR):
def __str__(self):
def __repr__(self):
def __hash__(self):
def __eq__(self, other):
def get_pid_file_name(self, conf_file):
def get_conf_file_name(self, pid_file):
def conf_files(self, **kwargs):
def pid_files(self, **kwargs):
def iter_pid_files(self, **kwargs):
def signal_pids(self, sig, **kwargs):
def get_running_pids(self, **kwargs):
def kill_running_pids(self, **kwargs):
def status(self, pids=None, **kwargs):
def spawn(self, conf_file, once=False, wait=True, daemon=True, **kwargs):
def wait(self, **kwargs):
def interact(self, **kwargs):
def launch(self, **kwargs):
def stop(self, **kwargs):
\OpenStack\swift-2014.1\swift\common\memcached.py
def md5hash(key):
def sanitize_timeout(timeout):
class MemcacheConnectionError(Exception):
class MemcachePoolTimeout(Timeout):
class MemcacheConnPool(Pool):
def __init__(self, server, size, connect_timeout):
def create(self):
def get(self):
def _upstream_fixed_get(self):
class MemcacheRing(object):
def __init__(self, servers, connect_timeout=CONN_TIMEOUT, io_timeout=IO_TIMEOUT, pool_timeout=POOL_TIMEOUT, tries=TRY_COUNT, allow_pickle=False, allow_unpickle=False, max_conns=2):
def _exception_occurred(self, server, e, action='talking', sock=None, fp=None, got_connection=True):
def _get_conns(self, key):
def _return_conn(self, server, fp, sock):
def set(self, key, value, serialize=True, timeout=0, time=0, min_compress_len=0):
def get(self, key):
def incr(self, key, delta=1, time=0, timeout=0):
def decr(self, key, delta=1, time=0, timeout=0):
def delete(self, key):
def set_multi(self, mapping, server_key, serialize=True, timeout=0, time=0, min_compress_len=0):
def get_multi(self, keys, server_key):
\OpenStack\swift-2014.1\swift\common\middleware\account_quotas.py
class AccountQuotaMiddleware(object):
def __init__(self, app, *args, **kwargs):
def __call__(self, request):
def filter_factory(global_conf, **local_conf):
def account_quota_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\acl.py
def clean_acl(name, value):
def format_acl_v1(groups=None, referrers=None, header_name=None):
def format_acl_v2(acl_dict):
def format_acl(version=1, **kwargs):
def parse_acl_v1(acl_string):
def parse_acl_v2(data):
def parse_acl(*args, **kwargs):
def referrer_allowed(referrer, referrer_acl):
def acls_from_account_info(info):
\OpenStack\swift-2014.1\swift\common\middleware\bulk.py
class CreateContainerError(Exception):
def __init__(self, msg, status_int, status):
def get_response_body(data_format, data_dict, error_list):
class Bulk(object):
def __init__(self, app, conf, max_containers_per_extraction=10000, max_failed_extractions=1000, max_deletes_per_request=10000, max_failed_deletes=1000, yield_frequency=10, retry_count=0, retry_interval=1.5, logger=None):
def create_container(self, req, container_path):
def get_objs_to_delete(self, req):
def handle_delete_iter(self, req, objs_to_delete=None, user_agent='BulkDelete', swift_source='BD', out_content_type='text/plain'):
def handle_extract_iter(self, req, compress_type, out_content_type='text/plain'):
def _process_delete(self, delete_path, obj_name, env, resp_dict, failed_files, failed_file_response, retry=0):
def __call__(self, req):
def filter_factory(global_conf, **local_conf):
def bulk_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\catch_errors.py
class CatchErrorsContext(WSGIContext):
def __init__(self, app, logger, trans_id_suffix=''):
def handle_request(self, env, start_response):
class CatchErrorMiddleware(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def except_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\cname_lookup.py
def lookup_cname(domain):
def is_ip(domain):
class CNAMELookupMiddleware(object):
def __init__(self, app, conf):
def _domain_endswith_in_storage_domain(self, a_domain):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def cname_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\container_quotas.py
class ContainerQuotaMiddleware(object):
def __init__(self, app, *args, **kwargs):
def bad_response(self, req, container_info):
def __call__(self, req):
def filter_factory(global_conf, **local_conf):
def container_quota_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\container_sync.py
class ContainerSync(object):
def __init__(self, app, conf):
def __call__(self, req):
def filter_factory(global_conf, **local_conf):
def cache_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\crossdomain.py
class CrossDomainMiddleware(object):
def __init__(self, app, conf, *args, **kwargs):
def GET(self, req):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def crossdomain_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\dlo.py
class GetContext(WSGIContext):
def __init__(self, dlo, logger):
def _get_container_listing(self, req, version, account, container, prefix, marker=''):
def _segment_listing_iterator(self, req, version, account, container, prefix, segments, first_byte=None, last_byte=None):
def get_or_head_response(self, req, x_object_manifest, response_headers=None):
def handle_request(self, req, start_response):
class DynamicLargeObject(object):
def __init__(self, app, conf):
def _populate_config_from_old_location(self, conf):
def __call__(self, env, start_response):
def validate_x_object_manifest_header(self, req, start_response):
def copy_hook(self, inner_hook):
def dlo_copy_hook(source_req, source_resp, sink_req):
def dlo_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\domain_remap.py
class DomainRemapMiddleware(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def domain_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\formpost.py
class FormInvalid(Exception):
class FormUnauthorized(Exception):
def _parse_attrs(header):
class _IterRequestsFileLikeObject(object):
def __init__(self, wsgi_input, boundary, input_buffer):
def read(self, length=None):
def readline(self):
def _iter_requests(wsgi_input, boundary):
class _CappedFileLikeObject(object):
def __init__(self, fp, max_file_size):
def read(self, size=None):
def readline(self):
class FormPost(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def _translate_form(self, env, boundary):
def _perform_subrequest(self, orig_env, attributes, fp, keys):
def _start_response(status, headers, exc_info=None):
def _get_keys(self, env):
def filter_factory(global_conf, **local_conf):
\OpenStack\swift-2014.1\swift\common\middleware\gatekeeper.py
def make_exclusion_test(exclusions):
class GatekeeperMiddleware(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def gatekeeper_response(status, response_headers, exc_info=None):
def gatekeeper_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\healthcheck.py
class HealthCheckMiddleware(object):
def __init__(self, app, conf):
def GET(self, req):
def DISABLED(self, req):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def healthcheck_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\keystoneauth.py
class KeystoneAuth(object):
def __init__(self, app, conf):
def __call__(self, environ, start_response):
def _keystone_identity(self, environ):
def _integral_keystone_identity(self, environ):
def _get_account_for_tenant(self, tenant_id):
def _reseller_check(self, account, tenant_id):
def _authorize_cross_tenant(self, user_id, user_name, tenant_id, tenant_name, roles):
def authorize(self, req):
def authorize_anonymous(self, req):
def _authorize_unconfirmed_identity(self, req, obj, referrers, roles):
def denied_response(self, req):
def filter_factory(global_conf, **local_conf):
def auth_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\list_endpoints.py
class ListEndpointsMiddleware(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def list_endpoints_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\memcache.py
class MemcacheMiddleware(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def cache_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\name_check.py
class NameCheckMiddleware(object):
def __init__(self, app, conf):
def check_character(self, req):
def check_length(self, req):
def check_regexp(self, req):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def name_check_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\proxy_logging.py
class ProxyLoggingMiddleware(object):
def __init__(self, app, conf, logger=None):
def method_from_req(self, req):
def req_already_logged(self, env):
def mark_req_logged(self, env):
def obscure_sensitive(self, value):
def log_request(self, req, status_int, bytes_received, bytes_sent, start_time, end_time):
def statsd_metric_name(self, req, status_int, method):
def __call__(self, env, start_response):
def my_start_response(status, headers, exc_info=None):
def status_int_for_logging(client_disconnect=False, start_status=None):
def iter_response(iterable):
def proxy_logger(app):
\OpenStack\swift-2014.1\swift\common\middleware\ratelimit.py
def interpret_conf_limits(conf, name_prefix):
def get_maxrate(ratelimits, size):
class MaxSleepTimeHitError(Exception):
class RateLimitMiddleware(object):
def __init__(self, app, conf, logger=None):
def get_container_size(self, account_name, container_name):
def get_ratelimitable_key_tuples(self, req, account_name, container_name=None, obj_name=None):
def _get_sleep_time(self, key, max_rate):
def handle_ratelimit(self, req, account_name, container_name, obj_name):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def limit_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\recon.py
class ReconMiddleware(object):
def __init__(self, app, conf, *args, **kwargs):
def _from_recon_cache(self, cache_keys, cache_file, openr=open):
def get_version(self):
def get_mounted(self, openr=open):
def get_load(self, openr=open):
def get_mem(self, openr=open):
def get_async_info(self):
def get_replication_info(self, recon_type):
def get_device_info(self):
def get_updater_info(self, recon_type):
def get_expirer_info(self, recon_type):
def get_auditor_info(self, recon_type):
def get_unmounted(self):
def get_diskusage(self):
def get_ring_md5(self, openr=open):
def get_quarantine_count(self):
def get_socket_info(self, openr=open):
def GET(self, req):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def recon_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\slo.py
def parse_input(raw_data):
class SloPutContext(WSGIContext):
def __init__(self, slo, slo_etag):
def handle_slo_put(self, req, start_response):
class SloGetContext(WSGIContext):
def __init__(self, slo):
def _fetch_sub_slo_segments(self, req, version, acc, con, obj):
def _segment_listing_iterator(self, req, version, account, segments, recursion_depth=1):
def _need_to_refetch_manifest(self, req):
def handle_slo_get_or_head(self, req, start_response):
def get_or_head_response(self, req, resp_headers, resp_iter):
def _manifest_head_response(self, req, response_headers):
def _manifest_get_response(self, req, content_length, response_headers, segments):
class StaticLargeObject(object):
def __init__(self, app, conf, min_segment_size=DEFAULT_MIN_SEGMENT_SIZE, max_manifest_segments=DEFAULT_MAX_MANIFEST_SEGMENTS, max_manifest_size=DEFAULT_MAX_MANIFEST_SIZE):
def handle_multipart_get_or_head(self, req, start_response):
def copy_hook(self, inner_hook):
def slo_hook(source_req, source_resp, sink_req):
def handle_multipart_put(self, req, start_response):
def get_segments_to_delete_iter(self, req):
def get_slo_segments(self, obj_name, req):
def handle_multipart_delete(self, req):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def slo_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\staticweb.py
class _StaticWebContext(WSGIContext):
def __init__(self, staticweb, version, account, container, obj):
def _error_response(self, response, env, start_response):
def _get_container_info(self, env):
def _listing(self, env, start_response, prefix=None):
def _build_css_path(self, prefix=''):
def handle_container(self, env, start_response):
def handle_object(self, env, start_response):
class StaticWeb(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def filter_factory(global_conf, **local_conf):
def staticweb_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\tempauth.py
class TempAuth(object):
def __init__(self, app, conf):
def __call__(self, env, start_response):
def _get_user_groups(self, account, account_user, account_id):
def get_groups(self, env, token):
def account_acls(self, req):
def extract_acl_and_report_errors(self, req):
def authorize(self, req):
def denied_response(self, req):
def handle(self, env, start_response):
def handle_request(self, req):
def handle_get_token(self, req):
def filter_factory(global_conf, **local_conf):
def auth_filter(app):
\OpenStack\swift-2014.1\swift\common\middleware\tempurl.py
def get_tempurl_keys_from_metadata(meta):
class TempURL(object):
def __init__(self, app, conf, methods=('GET', 'HEAD', 'PUT')):
def __call__(self, env, start_response):
def _start_response(status, headers, exc_info=None):
def _get_account(self, env):
def _get_temp_url_info(self, env):
def _get_keys(self, env, account):
def _get_hmacs(self, env, expires, keys, request_method=None):
def _invalid(self, env, start_response):
def _clean_incoming_headers(self, env):
def _clean_outgoing_headers(self, headers):
def filter_factory(global_conf, **local_conf):
\OpenStack\swift-2014.1\swift\common\middleware\__init__.py
\OpenStack\swift-2014.1\swift\common\request_helpers.py
def get_param(req, name, default=None):
def get_listing_content_type(req):
def split_and_validate_path(request, minsegs=1, maxsegs=None, rest_with_last=False):
def is_user_meta(server_type, key):
def is_sys_meta(server_type, key):
def is_sys_or_user_meta(server_type, key):
def strip_user_meta_prefix(server_type, key):
def strip_sys_meta_prefix(server_type, key):
def get_user_meta_prefix(server_type):
def get_sys_meta_prefix(server_type):
def remove_items(headers, condition):
def close_if_possible(maybe_closable):
def closing_if_possible(maybe_closable):
class SegmentedIterable(object):
def __init__(self, req, app, listing_iter, max_get_time, logger, ua_suffix, swift_source, name='', response=None):
def app_iter_range(self, *a, **kw):
def __iter__(self):
\OpenStack\swift-2014.1\swift\common\ring\builder.py
class RingBuilder(object):
def __init__(self, part_power, replicas, min_part_hours):
def weight_of_one_part(self):
def copy_from(self, builder):
def to_dict(self):
def change_min_part_hours(self, min_part_hours):
def set_replicas(self, new_replica_count):
def get_ring(self):
def add_dev(self, dev):
def set_dev_weight(self, dev_id, weight):
def remove_dev(self, dev_id):
def rebalance(self, seed=None):
def validate(self, stats=False):
def get_balance(self):
def pretend_min_part_hours_passed(self):
def get_part_devices(self, part):
def _iter_devs(self):
def _set_parts_wanted(self):
def _adjust_replica2part2dev_size(self):
def _initial_balance(self):
def _update_last_part_moves(self):
def _gather_reassign_parts(self):
def _reassign_parts(self, reassign_parts):
def _sort_key_for(self, dev):
def _build_max_replicas_by_tier(self):
def walk_tree(tier, replica_count):
def _devs_for_part(self, part):
def _replicas_for_part(self, part):
def _each_part_replica(self):
def load(cls, builder_file, open=open):
def save(self, builder_file):
def search_devs(self, search_values):
\OpenStack\swift-2014.1\swift\common\ring\ring.py
class RingData(object):
def __init__(self, replica2part2dev_id, devs, part_shift):
def deserialize_v1(cls, gz_file):
def load(cls, filename):
def serialize_v1(self, file_obj):
def save(self, filename):
def to_dict(self):
class Ring(object):
def __init__(self, serialized_path, reload_time=15, ring_name=None):
def _reload(self, force=False):
def _rebuild_tier_data(self):
def replica_count(self):
def partition_count(self):
def devs(self):
def has_changed(self):
def _get_part_nodes(self, part):
def get_part(self, account, container=None, obj=None):
def get_part_nodes(self, part):
def get_nodes(self, account, container=None, obj=None):
def get_more_nodes(self, part):
\OpenStack\swift-2014.1\swift\common\ring\utils.py
def tiers_for_dev(dev):
def build_tier_tree(devices):
def parse_search_value(search_value):
def parse_args(argvish):
def parse_builder_ring_filename_args(argvish):
def build_dev_from_opts(opts):
\OpenStack\swift-2014.1\swift\common\ring\__init__.py
\OpenStack\swift-2014.1\swift\common\swob.py
class _UTC(tzinfo):
def dst(self, dt):
def tzname(self, dt):
def _datetime_property(header):
def getter(self):
def setter(self, value):
def _header_property(header):
def getter(self):
def setter(self, value):
def _header_int_property(header):
def getter(self):
def setter(self, value):
class HeaderEnvironProxy(UserDict.DictMixin):
def __init__(self, environ):
def _normalize(self, key):
def __getitem__(self, key):
def __setitem__(self, key, value):
def __contains__(self, key):
def __delitem__(self, key):
def keys(self):
class HeaderKeyDict(dict):
def __init__(self, base_headers=None, **kwargs):
def update(self, other):
def __getitem__(self, key):
def __setitem__(self, key, value):
def __contains__(self, key):
def __delitem__(self, key):
def get(self, key, default=None):
def setdefault(self, key, value=None):
def pop(self, key, default=None):
def _resp_status_property():
def getter(self):
def setter(self, value):
def _resp_body_property():
def getter(self):
def setter(self, value):
def _resp_etag_property():
def getter(self):
def setter(self, value):
def _resp_content_type_property():
def getter(self):
def setter(self, value):
def _resp_charset_property():
def getter(self):
def setter(self, value):
def _resp_app_iter_property():
def getter(self):
def setter(self, value):
def _req_fancy_property(cls, header, even_if_nonexistent=False):
def getter(self):
def setter(self, value):
class Range(object):
def __init__(self, headerval):
def __str__(self):
def ranges_for_length(self, length):
class Match(object):
def __init__(self, headerval):
def __contains__(self, val):
class Accept(object):
def __init__(self, headerval):
def _get_types(self):
def best_match(self, options):
def __repr__(self):
def _req_environ_property(environ_field):
def getter(self):
def setter(self, value):
def _req_body_property():
def getter(self):
def setter(self, value):
def _host_url_property():
def getter(self):
class Request(object):
def __init__(self, environ):
def blank(cls, path, environ=None, headers=None, body=None, **kwargs):
def params(self):
def path_qs(self):
def path(self):
def swift_entity_path(self):
def url(self):
def as_referer(self):
def path_info_pop(self):
def copy_get(self):
def call_application(self, application):
def start_response(status, headers, exc_info=None):
def get_response(self, application):
def split_path(self, minsegs=1, maxsegs=None, rest_with_last=False):
def message_length(self):
def content_range_header_value(start, stop, size):
def content_range_header(start, stop, size):
def multi_range_iterator(ranges, content_type, boundary, size, sub_iter_gen):
class Response(object):
def __init__(self, body=None, status=200, headers=None, app_iter=None, request=None, conditional_response=False, **kw):
def _prepare_for_ranges(self, ranges):
def _response_iter(self, app_iter, body):
def absolute_location(self):
def www_authenticate(self):
def is_success(self):
def __call__(self, env, start_response):
class HTTPException(Response, Exception):
def __init__(self, *args, **kwargs):
def _wsgify_self(self, env, start_response):
def _wsgify_bare(env, start_response):
class StatusMap(object):
def __getitem__(self, key):
\OpenStack\swift-2014.1\swift\common\utils.py
class InvalidHashPathConfigError(ValueError):
def __str__(self):
def validate_hash_conf():
def get_hmac(request_method, path, expires, key):
def get_swift_info(admin=False, disallowed_sections=None):
def register_swift_info(name='swift', admin=False, **kwargs):
def backward(f, blocksize=4096):
def config_true_value(value):
def config_auto_int_value(value, default):
def noop_libc_function(*args):
def validate_configuration():
def load_libc_function(func_name, log_error=True):
def generate_trans_id(trans_id_suffix):
def get_trans_id_time(trans_id):
class FileLikeIter(object):
def __init__(self, iterable):
def __iter__(self):
def next(self):
def read(self, size=-1):
def readline(self, size=-1):
def readlines(self, sizehint=-1):
def close(self):
class FallocateWrapper(object):
def __init__(self, noop=False):
def __call__(self, fd, mode, offset, length):
def disable_fallocate():
def fallocate(fd, size):
def fsync(fd):
def fdatasync(fd):
def drop_buffer_cache(fd, offset, length):
def normalize_timestamp(timestamp):
def normalize_delete_at_timestamp(timestamp):
def mkdirs(path):
def renamer(old, new):
def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False):
def validate_device_partition(device, partition):
class RateLimitedIterator(object):
def __init__(self, iterable, elements_per_second, limit_after=0):
def __iter__(self):
def next(self):
OpenStack Index
|