coakka-http-runtime-python 1.1.2__cp311-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
coakka_http/values.py ADDED
@@ -0,0 +1,250 @@
1
+ 'Python-owned values for the public CoAkka HTTP host-inlined surface.'
2
+ from __future__ import annotations
3
+ import io
4
+ from collections.abc import Iterable,Iterator,Mapping
5
+ from dataclasses import dataclass,field
6
+ from enum import IntEnum,IntFlag
7
+ from itertools import islice
8
+ from types import MappingProxyType
9
+ from typing import Final
10
+ ABI_VERSION:Final=10
11
+ TIMEOUT_FOREVER:Final=(1<<64)-1
12
+ MONITOR_MAX_FAILURE_COUNTS:Final=48
13
+ MONITOR_FIXED_LATENCY_BUCKETS:Final=16
14
+ MONITOR_MAX_EVENTS_PER_READ:Final=64
15
+ _MAX_HEADER_COUNT:Final=100
16
+ class Capability(IntFlag):'Capabilities implemented by the installed native runtime.';INBOUND=1;TLS=2;MUTUAL_TLS=4;GZIP=8;REQUEST_STREAM=16;RESPONSE_STREAM=32;RESPONSE_TRAILERS=64;RESPONSE_WRITE_TIMEOUT=128;SERVER_SENT_EVENTS=256;WEBSOCKET=512;HTTP_2=1024;HTTP_3=2048;STATIC_FILES=4096;APPLICATION_FILES=8192;OUTBOUND=16384;ROUTE_REBIND=32768;OUTBOUND_LOGICAL_TARGET=65536;STATIC_FRONTEND=131072;HEALTH=262144;MONITOR=524288;ROUTE_PUBLICATION=1048576;ALL=2097151
17
+ class ResultCode(IntEnum):'Statuses returned by the native host surface.';OK=0;INVALID_ARGUMENT=1;INVALID_METHOD=2;INVALID_PATTERN=3;CAPACITY_EXHAUSTED=4;AMBIGUOUS=5;OUT_OF_MEMORY=6;DUPLICATE_ROUTE_ID=7;DUPLICATE_BINDING_ID=8;UNSUPPORTED=9;CLOSED=10;TIMEOUT=11;NOT_FOUND=12;IO_ERROR=13;STALE_EXCHANGE=14;UNKNOWN=127
18
+ class NotificationProfile(IntEnum):'Startup notification bounds; AUTO delegates selection to Core.\n\n Profiles never delay a partial turn to fill a batch. Request and terminal\n lanes resolve independently; runtime information reports their actual caps.\n ';AUTO=0;SMALL=1;MEDIUM=4;LARGE=8;XLARGE=16;XXLARGE=32;ULTRA=64
19
+ class DrainState(IntEnum):"Core's native drain outcome, distinct from a caller's wait deadline.";NOT_STARTED=0;PENDING=1;COMPLETE=2;EXPIRED=3;ABORTED=4;FAILED=5;UNSUPPORTED=6
20
+ class CpuPolicy(IntEnum):'Core dispatcher placement intent; not Python concurrency or a CPU quota.';AUTO=0;SINGLE=1
21
+ class CpuPlacement(IntEnum):"Core's entry-time result, not a connector platform guess.";APPLIED=0;SINGLE_AVAILABLE=1;UNSUPPORTED=2
22
+ @dataclass(frozen=True,slots=True)
23
+ class CpuInfo:"Immutable Core-issued placement facts for this service's owner thread.\n\n ``requested_policy`` retains user intent. ``placement`` distinguishes exact\n placement, a one-CPU constraint and unsupported AUTO. ``available_cpu_count``\n is logical affinity, not cgroup quota; zero means unknown on unsupported\n hosts. ``selected_cpu_ids`` lists only Core-selected CPUs (at most two).\n Children inherit the placement; existing application threads are unchanged.\n ";requested_policy:CpuPolicy|int;placement:CpuPlacement|int;available_cpu_count:int;selected_cpu_count:int;selected_cpu_ids:tuple[int,...]
24
+ @dataclass(frozen=True,slots=True)
25
+ class DrainOutcome:'One native wait result; PENDING means only the observation wait ended.\n\n ``status`` and ``state`` retain unknown numeric values. COMPLETE certifies\n native quiescence, not Python handler completion or successful delivery.\n ';status:int;state:DrainState|int
26
+ class FailureReason(IntEnum):'Known machine-readable causes retained on native operation errors.';NONE=0;INVALID_ARGUMENT=1;INVALID_STATE=2;CAPACITY=3;TIMEOUT=4;CLOSED=5;OUT_OF_MEMORY=6;UNSUPPORTED=7;LISTENER_START=8;TRANSPORT_SECURITY=9;IO_BACKEND=10;INTERNAL=11
27
+ class ListenerProtocol(IntEnum):'Wire protocol selected for the native listener.';HTTP_1_1=1;HTTP_2=2;HTTP_3=3
28
+ class TransportSecurity(IntEnum):'Transport security mode for listeners and outbound endpoints.';PLAINTEXT=1;TLS=2;MUTUAL_TLS=3
29
+ class BodyDelivery(IntEnum):'How one admitted request body is delivered.';INLINE=1;STREAM=2
30
+ class ApiParameterLocation(IntEnum):'Where one documented operation parameter appears on the wire.';PATH=1;QUERY=2;HEADER=3;COOKIE=4
31
+ class ApiSchemaKind(IntEnum):'Language-neutral schema shapes accepted by Core inspection.';BOOLEAN=1;INTEGER=2;NUMBER=3;STRING=4;BYTES=5;OBJECT=6;ARRAY=7;REFERENCE=8
32
+ class ApiAdditionalProperties(IntEnum):'Explicit object additional-property intent; Core validates its use.';UNSPECIFIED=0;FORBID=1;ALLOW=2
33
+ class CompressionMode(IntEnum):'Construction-time response compression mode.';DISABLED=1;GZIP=2
34
+ class IoBackend(IntEnum):'Optional native I/O backend request.';PLATFORM_DEFAULT=1;IO_URING=2
35
+ class IoBackendFallbackReason(IntEnum):'Why an opted-in runtime instance uses the platform default.';NONE=0;CONFIGURATION=1;UNAVAILABLE=2
36
+ class EventKind(IntEnum):'Kinds returned by the inbound event lane.';REQUEST=1;REQUEST_DATA=2;REQUEST_TRAILERS=3;REQUEST_END=4;REQUEST_CANCELLED=5;RESPONSE_WRITABLE=6;TERMINAL=7
37
+ class WebSocketEventKind(IntEnum):'WebSocket receive and send kinds.';OPEN=1;TEXT=2;BINARY=3;PING=4;PONG=5;WRITABLE=6;CLOSE=7;ACCEPT_FAILED=8
38
+ class OutboundStrategy(IntEnum):'Endpoint selection strategy for a logical outbound target.';SINGLE_OWNER=1;WEIGHTED_ROUND_ROBIN=2
39
+ class MonitorCollection(IntEnum):'Amount of monitoring truth retained by the runtime.';DISABLED=0;AGGREGATES=1;AGGREGATES_AND_EVENTS=2
40
+ class MonitorNotification(IntEnum):'How a monitor reader waits for newer truth.';POLL=0;SIGNAL=1
41
+ class MonitorLatency(IntEnum):'Latency histogram collection mode.';NONE=0;FIXED=1
42
+ class MonitorCategory(IntFlag):'Native monitor category bits.';LIFECYCLE=1;EXCHANGE=2;CONTROL=4;LATENCY=8;ALL=15
43
+ class MonitorApplyReason(IntEnum):'Typed result of applying a live monitor policy.';APPLIED=0;INVALID_ARGUMENT=1;INVALID_ENUM=2;UNSUPPORTED_CATEGORY=3;INVALID_CATEGORY_RELATIONSHIP=4;RESOURCE_RESERVATION_EXCEEDED=5;SIGNAL_NOT_RESERVED=6;GENERATION_CONFLICT=7;INVALID_LIFECYCLE=8;SEQUENCE_EXHAUSTED=9;INTERNAL=10
44
+ class MonitorEventKind(IntEnum):'Kinds of bounded operational monitor events.';LIFECYCLE_CHANGED=1;POLICY_APPLIED=2;POLICY_REJECTED=3;EXCHANGE_COMPLETED=4;EXCHANGE_FAILED=5;EXCHANGE_TIMED_OUT=6;EXCHANGE_DISCONNECTED=7;EXCHANGE_CANCELLED=8
45
+ class _CoreCode(IntEnum):
46
+ 'Preserve unknown uint32 observations without caching arbitrary values.'
47
+ @classmethod
48
+ def _missing_(cls,value:object)->_CoreCode|None:
49
+ if type(value)is not int or not 0<=value<=4294967295:return None
50
+ member=int.__new__(cls,value);member._name_=f"UNKNOWN_{value}";member._value_=value;return member
51
+ class TlsReloadMode(_CoreCode):'Retirement policy for connections on previous credential generations.';GRACEFUL=0;DRAIN_EXISTING=1
52
+ class TlsReloadReason(_CoreCode):"Core's typed result of preparing and publishing TLS credentials.";APPLIED=0;INVALID_CREDENTIAL=1;SECURITY_CHANGE=2;STALE_GENERATION=3;GENERATION_CONFLICT=4;BUSY=5;RETAINED_CAPACITY=6;PREPARATION_REJECTED=7;OUT_OF_MEMORY=8;CLOSED=9;INTERNAL=10
53
+ class OutboundReason(_CoreCode):"Core's causal result; unknown uint32 values stay intact without a cache.";RESPONSE=1;PROVIDER_FAILURE=2;PROVIDER_REJECTED=3;CANCELLED=4;DEADLINE_EXCEEDED=5;STOPPED=6;RESPONSE_HEAD_LIMIT=7;RESPONSE_BODY_LIMIT=8;RESPONSE_AGGREGATE_LIMIT=9;OUT_OF_MEMORY=10;CLOCK_FAILURE=11;INVALID_PROVIDER_RESULT=12
54
+ class OutboundPhase(_CoreCode):'Core-issued causal phase, never inferred from status or error text.';ADMISSION=1;PROVIDER_ADOPTION=2;TRANSPORT=3;RESPONSE=4;CANCELLATION=5;SHUTDOWN=6
55
+ class OutboundRetry(_CoreCode):'Core disposition; application idempotency/retry budgets remain application policy.';NEVER=1;IF_SAFE=2;DELIVERY_UNCERTAIN=3
56
+ class OutboundCertainty(_CoreCode):'Observed delivery evidence copied from Core, not a connector estimate.';NO_REQUEST_BYTES_SENT=1;REQUEST_UNCERTAIN=2;RESPONSE_HEAD_OBSERVED=3;COMPLETE_RESPONSE=4
57
+ class ControlCode(_CoreCode):'Core publication outcome; timeout/wakeup failure is not rejection.\n\n Retry the exact activation and intent to resolve those outcomes. BUSY\n means another unresolved activation prevented submission. Unknown numeric\n values stay intact; none are silently treated as APPLIED.\n ';APPLIED=0;INVALID_ARGUMENT=1;CLOSED=2;ACTIVATION_CONFLICT=3;ACTIVATION_EXPIRED=4;ACTIVATION_OUT_OF_ORDER=5;ROUTE_NOT_FOUND=6;GENERATION_MISMATCH=7;REVISION_MISMATCH=8;SEQUENCE_EXHAUSTED=9;REJECTED=10;OUT_OF_MEMORY=11;INTERNAL=12;TIMEOUT=13;WAKEUP_FAILED=14;BUSY=15
58
+ RouteRebindCode=ControlCode
59
+ RoutePublicationCode=ControlCode
60
+ class RequestRetirementState(_CoreCode):'Core request-capture state; unknown never permits handler disposal.';UNKNOWN=0;CAPTURED=1;QUIESCENT=2;STILL_ROUTABLE=3;NOT_APPLICABLE=4
61
+ class RequestRetirementCode(_CoreCode):'Core observation outcome, separate from publication success.';UNAVAILABLE=0;OBSERVED=1;INVALID_ARGUMENT=2;UNSUPPORTED=3;OUT_OF_MEMORY=4;CLOSED=5;BUSY=6;CONFLICT=7;EXPIRED=8;TIMEOUT=9;WAKEUP_FAILED=10;PUBLICATION_FAILED=11;OBSERVATION_FAILED=12;NOT_FOUND=13;SYSTEM_ERROR=14
62
+ @dataclass(frozen=True,slots=True)
63
+ class RequestRetirement:'Core proof tied to one publication, refreshed by its exact retry.\n\n ``state`` describes captures; ``code`` describes observation success.\n ``quiescent_sources`` counts acknowledging Core owners out of ``sources``,\n not CPUs/workers. Even QUIESCENT does not retire Python callbacks, sessions\n or application references. Republishing an identity starts a new lifetime.\n ';state:RequestRetirementState;code:RequestRetirementCode;quiescent_sources:int;sources:int
64
+ class ExecutionMode(_CoreCode):'Core-issued construction mode, for observation only; unknowns preserved.';DEFAULT=0;EXACT=1;PREFER_SUPPORTED=2
65
+ class ExecutionReason(_CoreCode):"Core's selection explanation, never a connector eligibility decision.";DEFAULTED=0;EXACT_SELECTED=1;PREFERRED_SELECTED=2;FACILITY_RESTRICTED=3;BUDGET_RESTRICTED=4;CPU_RESTRICTED=5;CPU_UNOBSERVED=6
66
+ @dataclass(frozen=True,slots=True)
67
+ class ExecutionSelection:"Core's immutable construction decision; meaningful only when observed.\n\n ``requested_mode`` and ``requested_count`` identify accepted intent; the\n count is zero only for DEFAULT. ``selected_count`` is Core's reservation,\n stable across start/drain/stop, not CPU utilization or live activity.\n ``reason`` is Core-issued and retains unknown uint32 observations.\n ";requested_mode:ExecutionMode;requested_count:int;selected_count:int;reason:ExecutionReason
68
+ @dataclass(frozen=True,slots=True)
69
+ class ExecutionInfo:"Core's cold loop observation, independent of CPU placement and workers.\n\n ``configured_event_loops`` is the accepted reservation, stable across stop\n or failed start. ``active_event_loops`` counts running/draining kernels;\n ``draining_event_loops`` is its draining subset. ``failed_event_loops`` is\n the current failed count, not history. ``observed`` distinguishes an actual\n instance observation from unknown. The bounded atomic sampling is not a\n simultaneous barrier and never grants permission to release request leases.\n ``selection`` groups the immutable Core construction decision; it is not\n application input and is meaningful only with ``observed=True``.\n ";configured_event_loops:int;active_event_loops:int;draining_event_loops:int;failed_event_loops:int;observed:bool;selection:ExecutionSelection
70
+ @dataclass(frozen=True,slots=True)
71
+ class ServicePlan:'Immutable result of checking a complete service declaration.';supported:bool;required_capabilities:Capability;adapter_capabilities:Capability;missing_capabilities:Capability
72
+ @dataclass(frozen=True,slots=True)
73
+ class RuntimeInfo:"Copied native startup truth for one runtime instance.\n\n ``request_notification_batch_size`` is Core's effective HTTP/1 cap.\n ``event_loop_cpu_mask`` is the requested CPU set, and its supported and\n applied flags describe the startup decision, not live OS affinity.\n ";abi_version:int;io_uring_requested:bool;io_uring_effective:bool;io_uring_compiled:bool;io_uring_probed:bool;io_uring_supported:bool;service_started:bool;fallback_reason:IoBackendFallbackReason;io_uring_probe_error:int;request_notification_batch_size:int;event_loop_cpu_mask:int;event_loop_cpu_mask_supported:bool;event_loop_cpu_mask_applied:bool;terminal_notification_batch_size:int;execution:ExecutionInfo;cpu:CpuInfo|None=None
74
+ @dataclass(frozen=True,slots=True)
75
+ class RuntimeInspection:"Global Core image/probe facts; no service or CPU placement is implied.\n\n ``features`` is the loaded image's mask. ``io_uring_probed`` distinguishes\n unknown support from an actual negative probe; inspection may probe once.\n ";abi_version:int;features:Capability;io_uring_compiled:bool;io_uring_probed:bool;io_uring_supported:bool;io_uring_probe_error:int
76
+ @dataclass(frozen=True,slots=True)
77
+ class Header:
78
+ 'One immutable text field; Core validates HTTP syntax on submission.\n\n Python checks text types here and byte representability at projection.\n Constructing this value is not a certificate of native HTTP admission.\n ';name:str;value:str
79
+ def __post_init__(self)->None:
80
+ if not isinstance(self.name,str)or not isinstance(self.value,str):raise TypeError('header name and value must be str')
81
+ @classmethod
82
+ def _from_native(cls,name:str,value:str)->Header:'Adopt decoded header text already validated by inbound Core I/O.';header=object.__new__(cls);object.__setattr__(header,'name',name);object.__setattr__(header,'value',value);return header
83
+ class _HeadersProjectionOwner:'Lazy private header view, excluded from dataclass value/copy fields.';__slots__='_native_headers',;_native_headers:object
84
+ def _header_index(entries:tuple[Header,...])->Mapping[str,tuple[str,...]]:
85
+ 'Build a complete read-only index before any owner can observe it.';index:dict[str,list[str]]={}
86
+ for entry in entries:index.setdefault(entry.name.casefold(),[]).append(entry.value)
87
+ return MappingProxyType({name:tuple(items)for(name,items)in index.items()})
88
+ @dataclass(frozen=True,slots=True,init=False,eq=False)
89
+ class Headers(_HeadersProjectionOwner):
90
+ 'Immutable ordered headers with average O(1) indexed name lookup.\n\n Core-origin headers build their bounded index on first name lookup; that\n first lookup costs O(n) for n fields. Iteration preserves wire order and\n never builds the index. Caller-created collections validate/index eagerly.\n ';_entries:tuple[Header,...];_index:Mapping[str,tuple[str,...]]|None
91
+ def __init__(self,entries:Iterable[Header]=())->None:
92
+ 'Validate entries and build the immutable case-folded lookup index.';values=tuple(islice(entries,_MAX_HEADER_COUNT+1))
93
+ if len(values)>_MAX_HEADER_COUNT:raise ValueError('header count exceeds the native bound')
94
+ if any(not isinstance(entry,Header)for entry in values):raise TypeError('headers must contain Header values')
95
+ object.__setattr__(self,'_entries',values);object.__setattr__(self,'_index',_header_index(values))
96
+ @classmethod
97
+ def _from_native(cls,entries:tuple[Header,...])->Headers:'Adopt privately owned, bounded, decoded Core fields without rescans.';value=object.__new__(cls);object.__setattr__(value,'_entries',entries);object.__setattr__(value,'_index',None);return value
98
+ def _lookup(self)->Mapping[str,tuple[str,...]]:
99
+ 'Publish only a complete immutable index; failed builds are retryable.';index=self._index
100
+ if index is None:index=_header_index(self._entries);object.__setattr__(self,'_index',index)
101
+ return index
102
+ def __len__(self)->int:'Return the number of fields, including duplicates.';return len(self._entries)
103
+ def __iter__(self)->Iterator[Header]:'Iterate fields in their original wire or declaration order.';return iter(self._entries)
104
+ def __getitem__(self,name:str)->str:
105
+ 'Return the first case-insensitive value for ``name``.';index=self._index
106
+ if index is None:index=self._lookup()
107
+ values=index.get(name.casefold())
108
+ if not values:raise KeyError(name)
109
+ return values[0]
110
+ def get(self,name:str,default:str|None=None)->str|None:
111
+ 'Return the first value or ``default`` when the name is absent.';index=self._index
112
+ if index is None:index=self._lookup()
113
+ values=index.get(name.casefold());return values[0]if values else default
114
+ def get_all(self,name:str)->tuple[str,...]:
115
+ 'Return all case-insensitive matches in original order.';index=self._index
116
+ if index is None:index=self._lookup()
117
+ return index.get(name.casefold(),())
118
+ _EMPTY_HEADERS:Final=Headers()
119
+ @dataclass(frozen=True,slots=True)
120
+ class ExchangeId:'Generation-checked inbound exchange handle.';slot:int;generation:int
121
+ @dataclass(frozen=True,slots=True)
122
+ class WebSocketId:'Generation-checked WebSocket session handle.';slot:int;generation:int
123
+ @dataclass(frozen=True,slots=True)
124
+ class OutboundId:'Generation-checked outbound call handle.';slot:int;generation:int
125
+ @dataclass(frozen=True,slots=True)
126
+ class Listener:'Native-owned listener and optional file-backed TLS identity.';bind_address:str='127.0.0.1';port:int=0;protocol:ListenerProtocol=ListenerProtocol.HTTP_1_1;security:TransportSecurity=TransportSecurity.PLAINTEXT;credential_generation:int=0;credential_id:str='';certificate_chain_file:str='';private_key_file:str='';trust_roots_file:str=''
127
+ @dataclass(frozen=True,slots=True)
128
+ class BodyPolicy:'Optional route body-admission policy enforced natively.';enabled:bool=False;accept_absent:bool=False;accept_other:bool=False;accept_form_urlencoded:bool=False;accept_multipart_form_data:bool=False;max_body_bytes:int=0
129
+ @dataclass(frozen=True,slots=True)
130
+ class ApiExample:'One documentation example; Core requires a nonempty unique name.';value:bytes|str;name:str='';summary:str=''
131
+ @dataclass(frozen=True,slots=True)
132
+ class ApiSchemaProperty:'One object property declaration.';name:str;schema:ApiSchema;description:str='';required:bool=False
133
+ @dataclass(frozen=True,slots=True)
134
+ class ApiSchema:'Recursive neutral schema; semantic validation remains Core-owned.';kind:ApiSchemaKind;format:str='';reference:str='';enum_values:tuple[str,...]=();items:ApiSchema|None=None;properties:tuple[ApiSchemaProperty,...]=();nullable:bool|None=None;additional_properties:ApiAdditionalProperties=ApiAdditionalProperties.UNSPECIFIED
135
+ @dataclass(frozen=True,slots=True)
136
+ class ApiSchemaDefinition:'One route-local named schema definition.';name:str;schema:ApiSchema
137
+ @dataclass(frozen=True,slots=True)
138
+ class ApiParameter:'One operation parameter; Core matches path parameters to route captures.';location:ApiParameterLocation;name:str;schema:ApiSchema;description:str='';examples:tuple[ApiExample,...]=();required:bool=False
139
+ @dataclass(frozen=True,slots=True)
140
+ class ApiMediaType:'One request or response media-type schema.';media_type:str;schema:ApiSchema;examples:tuple[ApiExample,...]=()
141
+ @dataclass(frozen=True,slots=True)
142
+ class ApiRequestBody:'Optional operation request body documentation.';content:tuple[ApiMediaType,...];description:str='';required:bool=False
143
+ @dataclass(frozen=True,slots=True)
144
+ class ApiResponseHeader:'One documented response header.';name:str;schema:ApiSchema;description:str='';examples:tuple[ApiExample,...]=()
145
+ @dataclass(frozen=True,slots=True)
146
+ class ApiResponse:'One status response, or the default response when ``status`` is None.';description:str;status:int|None=None;headers:tuple[ApiResponseHeader,...]=();content:tuple[ApiMediaType,...]=()
147
+ @dataclass(frozen=True,slots=True)
148
+ class ApiSecurityUse:'One referenced security scheme and its requested scopes.';scheme_reference:str;scopes:tuple[str,...]=()
149
+ @dataclass(frozen=True,slots=True)
150
+ class ApiSecurityRequirement:'One AND-group of security scheme uses.';uses:tuple[ApiSecurityUse,...]
151
+ @dataclass(frozen=True,slots=True)
152
+ class RouteApiMetadata:'Optional route documentation copied and validated by Core.';operation_id:str='';summary:str='';description:str='';tags:tuple[str,...]=();parameters:tuple[ApiParameter,...]=();request_body:ApiRequestBody|None=None;responses:tuple[ApiResponse,...]=();security_requirements:tuple[ApiSecurityRequirement,...]=();schema_definitions:tuple[ApiSchemaDefinition,...]=();deprecated:bool=False
153
+ @dataclass(frozen=True,slots=True)
154
+ class Route:'Construction-copied route and application binding identity.';id:int;method:str;pattern:str;handler_binding_id:int=0;body_delivery:BodyDelivery=BodyDelivery.INLINE;body_policy:BodyPolicy=field(default_factory=BodyPolicy);websocket:bool=False;api_metadata:RouteApiMetadata|None=None
155
+ @dataclass(frozen=True,slots=True)
156
+ class Limits:'Finite native resource ceilings; zero selects a bounded default.';max_routes:int=0;max_total_route_segments:int=0;max_route_bytes:int=0;max_total_route_metadata_bytes:int=0;max_captures_per_route:int=0;activation_history_capacity:int=0;max_connections:int=0;max_active_requests:int=0;request_queue_capacity:int=0;completion_queue_capacity:int=0;completion_batch_size:int=0;max_header_count:int=0;max_header_bytes:int=0;request_stream_chunk_slots:int=0;request_stream_max_retained_items:int=0;response_stream_chunk_slots:int=0;response_stream_max_retained_items:int=0;route_control_capacity:int=0;route_control_history_capacity:int=0;route_control_max_commands_per_turn:int=0;terminal_queue_capacity:int=0;deadline_tick_ms:int=0;connection_timeout_batch_size:int=0;request_notification_profile:NotificationProfile|int=NotificationProfile.AUTO;terminal_notification_profile:NotificationProfile|int=NotificationProfile.AUTO;event_loop_cpu_mask:int=0;max_request_body_bytes:int=0;max_response_body_bytes:int=0;keep_alive_timeout_ms:int=0;header_timeout_ms:int=0;body_timeout_ms:int=0;handler_timeout_ms:int=0;idle_timeout_ms:int=0;drain_timeout_ms:int=0;stop_timeout_ms:int=0;response_write_timeout_ms:int=0;request_stream_max_chunk_bytes:int=0;request_stream_max_trailer_bytes:int=0;request_stream_max_retained_bytes:int=0;request_stream_max_total_retained_bytes:int=0;response_stream_max_chunk_bytes:int=0;response_stream_max_trailer_bytes:int=0;response_stream_max_retained_bytes:int=0;response_stream_max_total_retained_bytes:int=0
157
+ @dataclass(frozen=True,slots=True)
158
+ class StaticMount:'Trusted static tree with optional index and SPA fallback.';url_prefix:str;root_path:str;index_file:str='';cache_control:str='';spa_fallback_file:str='';include_dotfiles:bool=False
159
+ @dataclass(frozen=True,slots=True)
160
+ class FileAuthority:'Approved root for application-selected file responses.';authority_id:int;root_path:str;max_file_bytes:int=0;max_active_files:int=0
161
+ @dataclass(frozen=True,slots=True)
162
+ class Compression:'Bounded response-compression policy.';mode:CompressionMode=CompressionMode.DISABLED;minimum_body_bytes:int=0;maximum_body_bytes:int=0;maximum_encoded_bytes:int=0;workspace_bytes:int=0;gzip_level:int=0
163
+ @dataclass(frozen=True,slots=True)
164
+ class OutboundEndpoint:'One copied endpoint for a logical outbound target.';node_id:str;connect_host:str;connect_port:int;http_authority:str;weight:int=1;security:TransportSecurity=TransportSecurity.PLAINTEXT;available:bool=True;tls_peer_identity:str='';tls_trust_generation:int=0;tls_client_identity_generation:int=0
165
+ @dataclass(frozen=True,slots=True)
166
+ class OutboundTarget:'Logical target with one immutable endpoint generation.';name:str;generation:int;endpoints:tuple[OutboundEndpoint,...];strategy:OutboundStrategy=OutboundStrategy.SINGLE_OWNER
167
+ @dataclass(frozen=True,slots=True)
168
+ class OutboundTrust:'Generation-keyed outbound CA material.';generation:int;ca_pem:bytes
169
+ @dataclass(frozen=True,slots=True)
170
+ class OutboundIdentity:'Generation-keyed outbound mutual-TLS identity.';generation:int;certificate_chain_pem:bytes;private_key_pem:bytes
171
+ @dataclass(frozen=True,slots=True)
172
+ class MonitorOptions:'Construction-time monitoring reservation and initial policy.';collection:MonitorCollection=MonitorCollection.DISABLED;event_capacity:int=0;max_events_per_read:int=0;categories:MonitorCategory=MonitorCategory(0);signal_reserved:bool=False;fixed_latency_buckets:bool=False
173
+ @dataclass(frozen=True,slots=True)
174
+ class RuntimeConfig:'Complete copied declaration for one runtime instance.';listener:Listener=field(default_factory=Listener);routes:tuple[Route,...]=();limits:Limits=field(default_factory=Limits);static_mounts:tuple[StaticMount,...]=();max_total_static_assets:int=0;file_authorities:tuple[FileAuthority,...]=();compression:Compression=field(default_factory=Compression);io_backend:IoBackend=IoBackend.PLATFORM_DEFAULT;monitor:MonitorOptions=field(default_factory=MonitorOptions);outbound_targets:tuple[OutboundTarget,...]=();outbound_trusts:tuple[OutboundTrust,...]=();outbound_identities:tuple[OutboundIdentity,...]=();reserve_websocket:bool=False;omit_buffered_success_events:bool=False
175
+ @dataclass(frozen=True,slots=True)
176
+ class PathParameter:'Route capture name and still-encoded value.';name:str;encoded_value:str
177
+ @dataclass(frozen=True,slots=True)
178
+ class QueryParameter:'Ordered encoded query item preserving absent versus empty.';encoded_key:str;encoded_value:str;has_value:bool
179
+ @dataclass(frozen=True,slots=True)
180
+ class Request:
181
+ 'Python-owned copy of one inbound request event.';exchange:ExchangeId;method:str;scheme:str;authority:str;target:str;headers:Headers;body:bytes;body_delivery:BodyDelivery;route_id:int;route_generation:int;binding_revision:int;handler_binding_id:int;path_parameters:tuple[PathParameter,...];query_parameters:tuple[QueryParameter,...];trailers:Headers;cancelled:bool=False;body_reader:io.BufferedIOBase|io.RawIOBase=field(init=False,repr=False,compare=False)
182
+ def __post_init__(self)->None:object.__setattr__(self,'body_reader',io.BytesIO(self.body))
183
+ def text(self,encoding:str='utf-8')->str:'Decode the copied body using strict error handling.';return self.body.decode(encoding,errors='strict')
184
+ def _attach_body_reader(self,reader:io.BufferedIOBase|io.RawIOBase)->None:
185
+ if self.body_delivery is not BodyDelivery.STREAM:raise RuntimeError('request does not use streamed body delivery')
186
+ object.__setattr__(self,'body_reader',reader)
187
+ def _set_stream_trailers(self,trailers:Headers)->None:object.__setattr__(self,'trailers',trailers)
188
+ @dataclass(frozen=True,slots=True)
189
+ class Event:'Copied event; data holds only REQUEST_DATA chunks, never private storage.\n\n REQUEST carries its typed request; trailers carry typed headers. All values\n outlive the native lease without retaining an extra raw event copy.\n ';kind:EventKind;exchange:ExchangeId;sequence:int;handler_binding_id:int;data:bytes=b'';request:Request|None=None;stream_trailers:Headers=_EMPTY_HEADERS
190
+ class _ResponseProjectionOwner:'Private memo storage, excluded from dataclass value/copy semantics.\n\n A projection belongs to its immutable response, never to a global cache or\n exchange. The slot is absent until first submission. Dataclass copies start\n without it, so native pointer owners never become serialized value fields.\n ';__slots__='_native_projection',;_native_projection:object
191
+ @dataclass(frozen=True,slots=True)
192
+ class Response(_ResponseProjectionOwner):
193
+ 'Buffered response copied synchronously by Core on every submission.\n\n Reusing an immutable value also reuses its private boundary projection;\n this does not cache HTTP outcomes or borrow data after the native call.\n ';status:int=200;headers:Headers=_EMPTY_HEADERS;body:bytes=b''
194
+ @classmethod
195
+ def text(cls,body:str,*,status:int=200,headers:Headers|Iterable[Header]=())->Response:
196
+ 'Create a UTF-8 response with a default content type.';values=headers if isinstance(headers,Headers)else Headers(headers)
197
+ if values.get('content-type')is None:values=Headers((*values,Header('content-type','text/plain; charset=utf-8')))
198
+ return cls(status=status,headers=values,body=body.encode())
199
+ @dataclass(frozen=True,slots=True)
200
+ class FileResponse:'Application-selected file under a configured authority.';authority_id:int;encoded_path:str;status:int=200;headers:Headers=_EMPTY_HEADERS
201
+ @dataclass(frozen=True,slots=True)
202
+ class SseEvent:'One typed server-sent event write.';data:bytes;event_type:bytes|None=None;id:bytes|None=None;retry_ms:int|None=None
203
+ @dataclass(frozen=True,slots=True)
204
+ class Failure:'Typed failure reason and bounded operator-facing detail.';reason:int;detail:bytes=b''
205
+ @dataclass(frozen=True,slots=True)
206
+ class WebSocketEvent:'Python-owned copy of one WebSocket event.';kind:WebSocketEventKind;session:WebSocketId;origin_exchange:ExchangeId;close_code:int;data:bytes
207
+ @dataclass(frozen=True,slots=True)
208
+ class OutboundRequest:'Copied logical-target outbound HTTP request.';logical_target:str;method:str;target:str;headers:Headers=_EMPTY_HEADERS;body:bytes=b'';timeout_ms:int=30000
209
+ @dataclass(frozen=True,slots=True)
210
+ class OutboundTerminal:'Python-owned copy of one outbound terminal event.';reason:OutboundReason;call:OutboundId;logical_target:str;target_generation:int;selected_node_id:str;phase:OutboundPhase;retry:OutboundRetry;certainty:OutboundCertainty;response_status:int;provider_code:int;response_headers:Headers;response_body:bytes;diagnostic:str
211
+ @dataclass(frozen=True,slots=True)
212
+ class Activity:'Finite current-work gauges from a health snapshot.';active_requests:int;pending_requests:int;active_connections:int;websocket_sessions:int;outbound_pending:int
213
+ @dataclass(frozen=True,slots=True)
214
+ class Health:'Pointer-free native health snapshot safe to retain.';lifecycle:int;snapshot_sequence:int;observed_monotonic_ns:int;progress_sequence:int;progress_monotonic_ns:int;acknowledged_probe_sequence:int;acknowledged_probe_monotonic_ns:int;route_generation:int;metadata_generation:int;binding_change_sequence:int;ready:bool;admission_open:bool;activity:Activity
215
+ @dataclass(frozen=True,slots=True)
216
+ class RouteIdentity:'Coherent route-generation identity.';route_count:int;route_generation:int;metadata_generation:int;binding_change_sequence:int
217
+ @dataclass(frozen=True,slots=True)
218
+ class RouteState:"One route's effective binding state.";route_id:int;handler_binding_id:int;binding_revision:int
219
+ @dataclass(frozen=True,slots=True)
220
+ class RouteSnapshot:'One coherent route-table and binding-table cut.';identity:RouteIdentity;routes:tuple[RouteState,...]
221
+ @dataclass(frozen=True,slots=True)
222
+ class RouteRebind:'Generation-checked handler-binding command.';activation_id:int;expected_route_generation:int;route_id:int;expected_binding_revision:int;new_handler_binding_id:int
223
+ @dataclass(frozen=True,slots=True)
224
+ class RouteRebindOutcome:'Effective state returned after a handler rebind attempt.';code:ControlCode;activation_id:int;operation_digest:int;route_generation:int;binding_change_sequence:int;route_id:int;previous_handler_binding_id:int;previous_binding_revision:int;effective_handler_binding_id:int;effective_binding_revision:int;changed:bool;replayed:bool;request_retirement:RequestRetirement
225
+ @dataclass(frozen=True,slots=True)
226
+ class RoutePublication:'Complete structural route replacement; never a delta.';activation_id:int;expected_route_generation:int;expected_metadata_generation:int;expected_binding_change_sequence:int;routes:tuple[Route,...]
227
+ @dataclass(frozen=True,slots=True)
228
+ class RoutePublicationOutcome:'Effective state returned after structural publication.';code:ControlCode;activation_id:int;operation_digest:int;previous_route_generation:int;previous_metadata_generation:int;previous_binding_change_sequence:int;effective_route_generation:int;effective_metadata_generation:int;effective_binding_change_sequence:int;actual:int;limit:int;route_count:int;rejected_route_index:int;changed:bool;replayed:bool;request_retirement:RequestRetirement
229
+ @dataclass(frozen=True,slots=True)
230
+ class TlsReloadRequest:'Compare-and-apply intent for a new file-backed TLS generation.';expected_generation:int;credential_generation:int;credential_id:str;security:TransportSecurity;certificate_chain_file:str;private_key_file:str;trust_roots_file:str='';mode:TlsReloadMode=TlsReloadMode.GRACEFUL
231
+ @dataclass(frozen=True,slots=True)
232
+ class TlsCredentials:'Effective credential state with no file paths or secret material.';security:TransportSecurity|int;reload_mode:TlsReloadMode;retired_generations:int;maximum_retired_generations:int;closed:bool;preparing:bool;generation:int;drain_before_generation:int;credential_id:str
233
+ @dataclass(frozen=True,slots=True)
234
+ class TlsReloadOutcome:"Core's apply or refusal outcome and its effective credential state.";reason:TlsReloadReason;changed:bool;effective:TlsCredentials
235
+ @dataclass(frozen=True,slots=True)
236
+ class MonitorPolicy:'Live monitor policy constrained by startup reservations.';collection:MonitorCollection;notification:MonitorNotification=MonitorNotification.POLL;latency:MonitorLatency=MonitorLatency.NONE;active_event_capacity:int=0;aggregate_categories:MonitorCategory=MonitorCategory(0);event_categories:MonitorCategory=MonitorCategory(0)
237
+ @dataclass(frozen=True,slots=True)
238
+ class MonitorConfig:'Effective pointer-free monitor configuration.';generation:int;collection_epoch:int;change_sequence:int;epoch_started_monotonic_ns:int;policy_applied_monotonic_ns:int;supported_categories:MonitorCategory;reserved_event_capacity:int;max_events_per_read:int;signal_reserved:bool;fixed_latency_buckets:bool;policy:MonitorPolicy
239
+ @dataclass(frozen=True,slots=True)
240
+ class MonitorApplyOutcome:'Applied or typed-rejected monitor policy result.';reason:MonitorApplyReason;actual:int;limit:int;changed:bool;effective:MonitorConfig
241
+ @dataclass(frozen=True,slots=True)
242
+ class MonitorFailureCount:'Count for one stable native failure reason.';reason:int;count:int
243
+ @dataclass(frozen=True,slots=True)
244
+ class MonitorLatencyBucket:'Fixed upper-bound latency bucket and count.';upper_bound_ns:int;count:int
245
+ @dataclass(frozen=True,slots=True)
246
+ class MonitorSnapshot:'Bounded aggregate and health snapshot.';collecting:bool;stale:bool;partial:bool;snapshot_sequence:int;observed_monotonic_ns:int;collected_change_sequence:int;admitted_requests:int;request_bytes:int;exchange_completed:int;exchange_failed:int;exchange_timed_out:int;exchange_disconnected:int;exchange_cancelled:int;response_status_family:tuple[int,int,int,int,int];retained_events:int;overwritten_events:int;dropped_events:int;signal_notifications:int;coalesced_signals:int;signal_failures:int;config:MonitorConfig;health:Health;failure_counts:tuple[MonitorFailureCount,...];latency_buckets:tuple[MonitorLatencyBucket,...]
247
+ @dataclass(frozen=True,slots=True)
248
+ class MonitorEvent:'One copied payload-free operational event.';kind:MonitorEventKind;sequence:int;change_sequence:int;config_generation:int;collection_epoch:int;observed_monotonic_ns:int;category:MonitorCategory;failure_reason:int;queue_scope:int;queue_depth:int;queue_capacity:int;exchange:ExchangeId
249
+ @dataclass(frozen=True,slots=True)
250
+ class MonitorEventPage:'Bounded monitor page plus loss and continuation metadata.';events:tuple[MonitorEvent,...];oldest_available_sequence:int;latest_sequence:int;overwritten_events:int;remaining_events:int
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: coakka-http-runtime-python
3
+ Version: 1.1.2
4
+ Summary: Python APIs for CoAkka HTTP Runtime, a shared HTTP server and client for polyglot applications
5
+ Requires-Python: >=3.11
6
+ License-Expression: Apache-2.0 AND LicenseRef-CoAkka-Native-Artifact-1.2
7
+ License-File: LICENSE
8
+ License-File: NATIVE-LICENSE.md
9
+ License-File: NOTICE
10
+ License-File: PACKAGE-LICENSE.md
11
+ Description-Content-Type: text/markdown
12
+ Keywords: coakka,http,polyglot,server,client
13
+ Project-URL: Homepage, https://github.com/phuong-tran/coakka-publish/tree/main/coakka-http-runtime
14
+ Project-URL: Documentation, https://github.com/phuong-tran/coakka-samples/tree/main/docs/coakka-http-runtime
15
+ Project-URL: Samples, https://github.com/phuong-tran/coakka-samples/tree/main/coakka-http-runtime
16
+ Project-URL: Issues, https://github.com/phuong-tran/coakka-samples/issues
17
+
18
+ # CoAkka HTTP Runtime for Python
19
+
20
+ <p align="center">
21
+ <img src="https://raw.githubusercontent.com/phuong-tran/coakka-samples/a539dfcd7dc8d93c5b1c61b1324899af13d47ca6/docs/common/assets/brand/coakka-logo.png" alt="CoAkka" width="480">
22
+ </p>
23
+
24
+ **One HTTP runtime, with Python-native service and request/response APIs.**
25
+
26
+ CoAkka HTTP Runtime is part of the CoAkka ecosystem, alongside CoAkka Runtime
27
+ and CoAkka Logger. It supplies a shared HTTP server and client for applications
28
+ written in different languages. Business handlers stay in the application; the
29
+ HTTP runtime owns protocol I/O, routing, bounded resources and lifecycle.
30
+
31
+ Use it for HTTP APIs, outbound HTTP requests, static files, streamed responses,
32
+ server-sent events and WebSocket sessions. Each language keeps its own API,
33
+ values and scheduling model.
34
+
35
+ ## Install
36
+
37
+ ```sh
38
+ python -m venv .venv
39
+ # Activate the virtual environment for your shell.
40
+ python -m pip install coakka-http-runtime-python==1.1.2
41
+ ```
42
+
43
+ Import the package as `coakka_http`. Python3.11 or newer is required. pip
44
+ selects a complete platform wheel containing the matching runtime libraries;
45
+ there is no separate SDK or provider to install. Request and response values
46
+ remain Python-owned and service shutdown is explicit.
47
+
48
+ ## Platforms
49
+
50
+ The package family covers macOS ARM64, Linux ARM64 and x86_64, and Windows
51
+ ARM64 and x86_64. WSL2 uses the Linux x86_64 package. Linux requires glibc2.28
52
+ or newer; macOS requires version11 or newer. Qualification and registry
53
+ availability belong to the exact release record.
54
+
55
+ ## Documentation and examples
56
+
57
+ - [HTTP Runtime documentation](https://github.com/phuong-tran/coakka-samples/tree/main/docs/coakka-http-runtime)
58
+ - [Runnable HTTP examples](https://github.com/phuong-tran/coakka-samples/tree/main/coakka-http-runtime)
59
+ - [Artifacts, checksums and release records](https://github.com/phuong-tran/coakka-publish/tree/main/coakka-http-runtime)
60
+ - [CoAkka ecosystem](https://github.com/phuong-tran/coakka-samples/tree/main/docs/common)
61
+ - [Questions and issues](https://github.com/phuong-tran/coakka-samples/issues)
62
+
63
+ Licensing scopes and required notices are described in `PACKAGE-LICENSE.md`.
@@ -0,0 +1,19 @@
1
+ coakka_http/__init__.py,sha256=Ak2RAnOv6H29PMNOFlUMX5QEC3qiePyCnNuKGpT1WmQ,4498
2
+ coakka_http/_native.py,sha256=ER-J8PLg-v6YptEVXB8VTL6t0O2XcGrUVeoSwv_rFes,45753
3
+ coakka_http/_package.json,sha256=s7stJV6Pd2qGRTyUwG3TZa76RWQ5pZkxmTMrsfmBOlE,407
4
+ coakka_http/_projection.py,sha256=axFEkZ0zL4Q99Ia2qVZCAEanHq3XWoA2omWf-QyC_uU,4770
5
+ coakka_http/_service_cpu.py,sha256=jdPhYqBDT8hzpw-rC9YcIzqH8w7KyirLxJQzAPOKaYk,5909
6
+ coakka_http/native/_coakka_http_projection.pyd,sha256=QJst54G1v_JvVyyy8hkAqRUNek5QlkgkxMyVAkx47no,130048
7
+ coakka_http/native/coakka_http_host.dll,sha256=8RelxfY-7LLRkBb1kMNinNVNiQYEFz7DjTZXC1irTGg,8433152
8
+ coakka_http/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ coakka_http/runtime.py,sha256=i_ZQXtlkqWb8pEby6AwlYFZduBQKGxrRdWhc5D6hMPY,73047
10
+ coakka_http/service.py,sha256=dFQCAFmVhF44YUpiW-IKOWtvG1jhgGxDdLhFSMhsEls,60299
11
+ coakka_http/values.py,sha256=GvTnFRLEJQI8fWMRwstJUX6uF-S3GsTXunY-NBtAr_8,34219
12
+ coakka_http_runtime_python-1.1.2.dist-info/METADATA,sha256=otf54QyxYkxTgKCoj264yDJQwpW4uuqhGn36V6Fu_qs,3002
13
+ coakka_http_runtime_python-1.1.2.dist-info/WHEEL,sha256=r5Hf-xdOHloU2V6VT1Yl2k5j2Tt8IPteqo_i6SiaCPA,99
14
+ coakka_http_runtime_python-1.1.2.dist-info/assets/coakka-logo.png,sha256=n_ZtG7yCDiBnvJF7UftpXIvUQMBg0VOXipJme3wXzjs,39942
15
+ coakka_http_runtime_python-1.1.2.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
16
+ coakka_http_runtime_python-1.1.2.dist-info/licenses/NATIVE-LICENSE.md,sha256=CJ_5TPJbFweuPn0Du4Hw3fuE6H-3R29f6n69LNLwGSU,6482
17
+ coakka_http_runtime_python-1.1.2.dist-info/licenses/NOTICE,sha256=rXHxDI0mL5JfKIl54JM5WIf_sl1S-RSgKHJ2grXCoCw,48138
18
+ coakka_http_runtime_python-1.1.2.dist-info/licenses/PACKAGE-LICENSE.md,sha256=MlFxCVlXmK1LeAEXeD6RqgGWuNbWmeXVQbX4Qcci4G4,1384
19
+ coakka_http_runtime_python-1.1.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: coakka-http-package
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-abi3-win_amd64
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.