litefs.server package

class litefs.server.BufferedRWPair(reader, writer, buffer_size=8192, /)

基类:_BufferedIOBase

A buffered reader and writer object together.

A buffered reader object and buffered writer object put together to form a sequential IO object that can read and write. This is typically used with a socket or two-way pipe.

reader and writer are RawIOBase objects that are readable and writeable respectively. If the buffer_size is omitted it defaults to DEFAULT_BUFFER_SIZE.

close()

Flush and close the IO object.

This method has no effect if the file is already closed.

closed
flush()

Flush write buffers, if applicable.

This is not implemented for read-only and non-blocking streams.

isatty()

Return whether this is an 'interactive' stream.

Return False if it can't be determined.

peek()
read()

Read and return up to n bytes.

If the argument is omitted, None, or negative, reads and returns all data until EOF.

If the argument is positive, and the underlying raw stream is not 'interactive', multiple raw reads may be issued to satisfy the byte count (unless EOF is reached first). But for interactive raw streams (as well as sockets and pipes), at most one raw read will be issued, and a short result does not imply that EOF is imminent.

Returns an empty bytes object on EOF.

Returns None if the underlying raw stream was open in non-blocking mode and no data is available at the moment.

read1()

Read and return up to n bytes, with at most one read() call to the underlying raw stream. A short result does not imply that EOF is imminent.

Returns an empty bytes object on EOF.

readable()

Return whether object was opened for reading.

If False, read() will raise OSError.

readinto()
readinto1()
writable()

Return whether object was opened for writing.

If False, write() will raise OSError.

write()

Write the given buffer to the IO stream.

Returns the number of bytes written, which is always the length of b in bytes.

Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment.

class litefs.server.HTTPServer(server_address, RequestHandlerClass, bind_and_activate=True)[源代码]

基类:TCPServer

allow_reuse_address = 1
max_request_size = 10485760
server_bind()[源代码]
class litefs.server.ProcessHTTPServer(server_address, RequestHandlerClass, bind_and_activate=True, processes=4)[源代码]

基类:HTTPServer

多进程 HTTP 服务器

server_forever(poll_interval=0.1)[源代码]

启动多进程服务器

shutdown()[源代码]

关闭服务器

class litefs.server.SocketIO(server, sock)[源代码]

基类:RawIOBase

close()[源代码]

Flush and close the IO object.

This method has no effect if the file is already closed.

fileno()[源代码]

Returns underlying file descriptor if one exists.

OSError is raised if the IO object does not use a file descriptor.

read_gr = None
readable()[源代码]

Return whether object was opened for reading.

If False, read() will raise OSError.

readinto(b)[源代码]
writable()[源代码]

Return whether object was opened for writing.

If False, write() will raise OSError.

write(data)[源代码]
write_gr = None
class litefs.server.TCPServer(server_address, RequestHandlerClass, bind_and_activate=True)[源代码]

基类:object

Classic Python TCPServer

address_family = 2
allow_reuse_address = True
close_request(request)[源代码]
fileno()[源代码]
finish_request(request, client_address)[源代码]
get_request()[源代码]
handle_error(request, client_address)[源代码]
handle_request()[源代码]
handle_timeout()[源代码]
process_request(request, client_address)[源代码]
request_queue_size = 4194304
server_activate()[源代码]
server_bind()[源代码]
server_close()[源代码]
server_forever(poll_interval=0.1)[源代码]
shutdown()[源代码]
shutdown_request(request)[源代码]
socket_type = 1
start()[源代码]
verify_request(request, client_address)[源代码]
class litefs.server.WSGIServer(server_address, RequestHandlerClass, bind_and_activate=True)[源代码]

基类:HTTPServer

application = None
get_app()[源代码]
server_bind()[源代码]
set_app(application)[源代码]
setup_environ()[源代码]
litefs.server.mainloop(poll_interval=0.1)[源代码]
litefs.server.make_environ(server, rw, client_address)[源代码]
litefs.server.make_headers(rw)[源代码]

Submodules

litefs.server.http_server module

class litefs.server.http_server.Epoll[源代码]

基类:object

close()[源代码]
poll(poll_interval=0.2)[源代码]
register(server_socket)[源代码]
unregister(server_socket)[源代码]
class litefs.server.http_server.HTTPServer(server_address, RequestHandlerClass, bind_and_activate=True)[源代码]

基类:TCPServer

allow_reuse_address = 1
max_request_size = 10485760
server_bind()[源代码]
class litefs.server.http_server.ProcessHTTPServer(server_address, RequestHandlerClass, bind_and_activate=True, processes=4)[源代码]

基类:HTTPServer

多进程 HTTP 服务器

server_forever(poll_interval=0.1)[源代码]

启动多进程服务器

shutdown()[源代码]

关闭服务器

class litefs.server.http_server.SocketIO(server, sock)[源代码]

基类:RawIOBase

close()[源代码]

Flush and close the IO object.

This method has no effect if the file is already closed.

fileno()[源代码]

Returns underlying file descriptor if one exists.

OSError is raised if the IO object does not use a file descriptor.

read_gr = None
readable()[源代码]

Return whether object was opened for reading.

If False, read() will raise OSError.

readinto(b)[源代码]
writable()[源代码]

Return whether object was opened for writing.

If False, write() will raise OSError.

write(data)[源代码]
write_gr = None
class litefs.server.http_server.TCPServer(server_address, RequestHandlerClass, bind_and_activate=True)[源代码]

基类:object

Classic Python TCPServer

address_family = 2
allow_reuse_address = True
close_request(request)[源代码]
fileno()[源代码]
finish_request(request, client_address)[源代码]
get_request()[源代码]
handle_error(request, client_address)[源代码]
handle_request()[源代码]
handle_timeout()[源代码]
process_request(request, client_address)[源代码]
request_queue_size = 4194304
server_activate()[源代码]
server_bind()[源代码]
server_close()[源代码]
server_forever(poll_interval=0.1)[源代码]
shutdown()[源代码]
shutdown_request(request)[源代码]
socket_type = 1
start()[源代码]
verify_request(request, client_address)[源代码]
class litefs.server.http_server.WSGIServer(server_address, RequestHandlerClass, bind_and_activate=True)[源代码]

基类:HTTPServer

application = None
get_app()[源代码]
server_bind()[源代码]
set_app(application)[源代码]
setup_environ()[源代码]
litefs.server.http_server.mainloop(poll_interval=0.1)[源代码]
litefs.server.http_server.make_environ(server, rw, client_address)[源代码]
litefs.server.http_server.make_headers(rw)[源代码]
litefs.server.http_server.parse_header(line)[源代码]
litefs.server.http_server.server_forever(poll_interval=0.1)