def __init__(self, conf, memcache=None, logger=None, account_ring=None, container_ring=None, object_ring=None): if conf is None: conf = {} if logger is None: self.logger = get_logger(conf, log_route='api-server') else: self.logger = logger gate_dir = conf.get('gate_dir', '/etc/gate') self.client_timeout = int(conf.get('client_timeout', 60)) self.put_queue_depth = int(conf.get('put_queue_depth', 10)) self.object_chunk_size = int(conf.get('object_chunk_size', 65536)) self.client_chunk_size = int(conf.get('client_chunk_size', 65536)) self.error_suppression_interval = \ int(conf.get('error_suppression_interval', 60)) self.error_suppression_limit = \ int(conf.get('error_suppression_limit', 10)) self.deny_host_headers = [ host.strip() for host in conf.get('deny_host_headers', '').split(',') if host.strip() ] self.rate_limit_after_segment = \ int(conf.get('rate_limit_after_segment', 10)) self.rate_limit_segments_per_sec = \ int(conf.get('rate_limit_segments_per_sec', 1))
def __init__(self, conf, memcache=None, logger=None, account_ring=None, container_ring=None, object_ring=None): if conf is None: conf = {} if logger is None: self.logger = get_logger(conf, log_route='api-server') else: self.logger = logger gate_dir = conf.get('gate_dir', '/etc/gate') self.client_timeout = int(conf.get('client_timeout', 60)) self.put_queue_depth = int(conf.get('put_queue_depth', 10)) self.object_chunk_size = int(conf.get('object_chunk_size', 65536)) self.client_chunk_size = int(conf.get('client_chunk_size', 65536)) self.error_suppression_interval = \ int(conf.get('error_suppression_interval', 60)) self.error_suppression_limit = \ int(conf.get('error_suppression_limit', 10)) self.deny_host_headers = [ host.strip() for host in conf.get('deny_host_headers', '').split(',') if host.strip()] self.rate_limit_after_segment = \ int(conf.get('rate_limit_after_segment', 10)) self.rate_limit_segments_per_sec = \ int(conf.get('rate_limit_segments_per_sec', 1))
def __init__(self, conf): self.conf = conf self.logger = get_logger(conf, log_route='transport.memcached') self.auth_url = conf.get('auth_url', 'http://localhost:5000/') self.auth_user = conf.get('auth_user', 'gate') self.auth_key = conf.get('auth_key', 'gate') self.proxy = conf.get('proxy', 'None') if self.proxy == 'None': self.proxy = None self.retries = int(conf.get('retries', '4')) self.swift_proxy = conf.get('swift_proxy', 'None') if self.swift_proxy == 'None': self.swift_proxy = None self.cache_path = conf.get('cache_path', '/var/gate/object-store/cache') dir_path = os.path.dirname(os.path.abspath(cache_path)) if not os.path.exists(dir_path): os.makedirs(dir_path) self.concurrency = int(conf.get('put_threads', 5)) self.segment_size = int(conf.get('segment_size', 262144000))
raise sleep(0.1) if not sock: raise Exception(_('Could not bind to %s:%s ' 'after trying for %s seconds') % ( bind_addr[0], bind_addr[1], bind_timeout)) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # in my experience, sockets can hang around forever without keepalive sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) if hasattr(socket, 'TCP_KEEPIDLE'): sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600) if warn_ssl: ssl_warning_message = 'WARNING: SSL should only be enabled for ' \ 'testing purposes. Use external SSL ' \ 'termination for a production deployment.' get_logger(conf).warning(ssl_warning_message) print _(ssl_warning_message) return sock # TODO: pull pieces of this out to test def run_wsgi(conf_file, app_section, *args, **kwargs): """ Runs the server using the specified number of workers. :param conf_file: Path to paste.deploy style configuration file :param app_section: App name from conf file to load config from """ # Load configuration, Set logger and Load request processor try: (app, conf, logger, log_name) = \
def __init__(self, conf): self.conf = conf self.logger = get_logger(conf, log_route='transport.memcached') self.servers = conf.get('servers', 'localhost:11211').split(';') self.debug = config_true_value(conf.get('debug', 'False'))
sleep(0.1) if not sock: raise Exception( _('Could not bind to %s:%s ' 'after trying for %s seconds') % (bind_addr[0], bind_addr[1], bind_timeout)) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # in my experience, sockets can hang around forever without keepalive sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) if hasattr(socket, 'TCP_KEEPIDLE'): sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600) if warn_ssl: ssl_warning_message = 'WARNING: SSL should only be enabled for ' \ 'testing purposes. Use external SSL ' \ 'termination for a production deployment.' get_logger(conf).warning(ssl_warning_message) print _(ssl_warning_message) return sock # TODO: pull pieces of this out to test def run_wsgi(conf_file, app_section, *args, **kwargs): """ Runs the server using the specified number of workers. :param conf_file: Path to paste.deploy style configuration file :param app_section: App name from conf file to load config from """ # Load configuration, Set logger and Load request processor try: (app, conf, logger, log_name) = \