Silk

silk/http_connection_pool_native

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu.

Native direct TCP, Unix, and HTTPS contexts for bounded HTTP connection pools.

When to use

Use withDirectPool for direct TCP and HTTPS origins. Use withUnixPool when one exact Unix path supplies the physical transport for HTTP or HTTPS origins.

Details

Each pool owns one immutable Context. Construction copies the prepared trust snapshot before pool publication. Each HTTPS opening receives another bounded copy before contact. Native acquisition gets the checkout deadline, but each published HTTP owner retains no acquisition or request deadline.

Gotchas

These contexts reject proxy keys with PoolError.ContextMismatch before native contact. A later owned proxy transport seam must provide a different context.

Import as PoolNative with import silk.http_connection_pool_native as PoolNative.

Public declarations: 8.

Context

pub struct Context

An immutable native provider, HTTP, route, TLS, ALPN, and prepared-trust context.

Details

Construction is available only through withDirectPool and withUnixPool. The context accepts direct keys for its route and rejects all sealed proxy keys before native contact.

limitsEqual

pub fn limitsEqual<'life0, 'life1>(left: &'life0 silk/http_client.Limits, right: &'life1 silk/http_client.Limits) -> bool

Compares every HTTP connection, parser, framing, capacity, and discard limit.

Implementation silk/http_connection_pool.PoolContextCopy<silk/allocator.OutOfMemoryError | silk/trust_snapshot.TrustSourceError, ? &mut silk/allocator.Allocator> for Context

impl silk/http_connection_pool.PoolContextCopy<silk/allocator.OutOfMemoryError | silk/trust_snapshot.TrustSourceError, ? &mut silk/allocator.Allocator> for Context

Operation copy

copy = Context.copyContext

Implementation silk/http_connection_pool.PoolContext<silk/http_connection_pool.ConnectionKey, silk/http_client_native.NativeTransport, silk/allocator.OutOfMemoryError | silk/http_client.ClientError | silk/http_client_native.NativeClientError | silk/https_identity.IdentityError | silk/native_socket.NativeSocketError | silk/resolver.ResolverError | silk/tls_connection.ConnectionError | silk/trust_snapshot.TrustSourceError, ? &mut silk/allocator.Allocator | &mut silk/monotonic_clock.MonotonicClock | &mut silk/random.Random | &mut silk/system_clock.SystemClock> for Context

impl silk/http_connection_pool.PoolContext<silk/http_connection_pool.ConnectionKey, silk/http_client_native.NativeTransport, silk/allocator.OutOfMemoryError | silk/http_client.ClientError | silk/http_client_native.NativeClientError | silk/https_identity.IdentityError | silk/native_socket.NativeSocketError | silk/resolver.ResolverError | silk/tls_connection.ConnectionError | silk/trust_snapshot.TrustSourceError, ? &mut silk/allocator.Allocator | &mut silk/monotonic_clock.MonotonicClock | &mut silk/random.Random | &mut silk/system_clock.SystemClock> for Context

Operation accepts

accepts = Context.acceptsKey

Operation acquire

acquire = Context.acquire

withDirectPool

pub effect<'env> fn withDirectPool<A, E, ?R, H: 'env, 'life4: 'env, 'env>(config: Config, options: Options, limits: Limits, preparedTrust: silk/option.Option<&'life4 silk/trust_snapshot.TrustSnapshot>, handler: H) -> A ! E | PoolError | TrustSourceError | OutOfMemoryError ? R | &mut Allocator where &mut NativeTransport provides &HttpTransport from &mut HttpTransport

Constructs and lends a bounded pool for direct TCP and HTTPS origins.

Details

Construction copies preparedTrust under options.trust.snapshot before pool publication. The context clears options.deadline; each checkout supplies its opening deadline separately.

withUnixPool

pub effect<'env> fn withUnixPool<A, E, ?R, H: 'env, 'life4: 'env, 'life5: 'env, 'env>(config: Config, path: &'life4 [u8], options: Options, limits: Limits, preparedTrust: silk/option.Option<&'life5 silk/trust_snapshot.TrustSnapshot>, handler: H) -> A ! E | PoolError | NativeClientError | NativeSocketError | TrustSourceError | OutOfMemoryError ? R | &mut Allocator where &mut NativeTransport provides &HttpTransport from &mut HttpTransport

Constructs and lends a bounded pool for one exact Unix path and HTTP or HTTPS origins.

Details

Construction copies the path and preparedTrust before pool publication. TLS authenticates each original origin. The context clears options.deadline before any checkout.

copyHandle

pub effect<'life0> fn copyHandle<'life0>(handle: &'life0 silk/http_connection_pool.Handle<silk/http_connection_pool.ConnectionKey, silk/http_client_native.NativeTransport, silk/http_connection_pool_native.Context>) -> silk/http_connection_pool.Handle<silk/http_connection_pool.ConnectionKey, silk/http_client_native.NativeTransport, silk/http_connection_pool_native.Context> ! TrustSourceError | OutOfMemoryError ? &mut Allocator

Copies the complete native context before publishing another shared-state alias.

Details

Trust or allocation failure leaves the source handle valid and publishes no new handle.

acceptsLimits

pub fn acceptsLimits<'life0>(handle: &'life0 silk/http_connection_pool.Handle<silk/http_connection_pool.ConnectionKey, silk/http_client_native.NativeTransport, silk/http_connection_pool_native.Context>, limits: Limits) -> bool

Reports whether a handle's frozen HTTP connection limits exactly match limits.

Details

Fetch-style clients use this pre-contact admission before a checkout can reuse or open an owner. Every parser, framing, capacity, informational, request-budget, and discard field participates; the comparison does not inspect mutable pool state.

withConnection

pub effect<'env> fn withConnection<A, E, ?R, H: 'env, 'life4: 'env, 'env>(handle: &'life4 silk/http_connection_pool.Handle<silk/http_connection_pool.ConnectionKey, silk/http_client_native.NativeTransport, silk/http_connection_pool_native.Context>, origin: Origin, requestDeadline: silk/option.Option<silk/system_clock.Instant>, acquisitionDeadline: silk/option.Option<silk/system_clock.Instant>, handler: H) -> silk/http_connection_pool.CheckoutResult<A> ! E | PoolError | NativeClientError | ClientError | ResolverError | NativeSocketError | ConnectionError | IdentityError | TrustSourceError | OutOfMemoryError ? R | &mut Allocator | &mut MonotonicClock | &mut SystemClock | &mut Random where &mut NativeTransport provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut NativeTransport provides &HttpTransport from &mut HttpTransport

Checks out one direct origin and lends its exclusive connection to handler.

Details

requestDeadline remains the request bound. acquisitionDeadline can only shorten opening. A Unix or proxy pool returns PoolError.ContextMismatch before native contact.

withUnixConnection

pub effect<'env> fn withUnixConnection<A, E, ?R, H: 'env, 'life4: 'env, 'life5: 'env, 'env>(handle: &'life4 silk/http_connection_pool.Handle<silk/http_connection_pool.ConnectionKey, silk/http_client_native.NativeTransport, silk/http_connection_pool_native.Context>, path: &'life5 [u8], origin: Origin, requestDeadline: silk/option.Option<silk/system_clock.Instant>, acquisitionDeadline: silk/option.Option<silk/system_clock.Instant>, handler: H) -> silk/http_connection_pool.CheckoutResult<A> ! E | PoolError | NativeClientError | ClientError | ResolverError | NativeSocketError | ConnectionError | IdentityError | TrustSourceError | OutOfMemoryError ? R | &mut Allocator | &mut MonotonicClock | &mut SystemClock | &mut Random where &mut NativeTransport provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut NativeTransport provides &HttpTransport from &mut HttpTransport

Checks out one origin through the pool's exact Unix path and lends its connection to handler.

Details

The supplied path forms the conservative key. A different path returns PoolError.ContextMismatch before native contact. The request deadline remains unchanged.

On this page