Skip to content

Commit

Permalink
experiment: add elastic-sized object pool implementation (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobz authored Sep 16, 2024
1 parent c1acd46 commit 9f2b116
Show file tree
Hide file tree
Showing 7 changed files with 362 additions and 19 deletions.
8 changes: 4 additions & 4 deletions lib/saluki-core/src/components/sources/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use saluki_health::{Health, HealthRegistry};

use crate::{
components::ComponentContext,
pooling::FixedSizeObjectPool,
pooling::ElasticObjectPool,
topology::{
interconnect::{EventBuffer, Forwarder},
shutdown::ComponentShutdownHandle,
Expand All @@ -15,7 +15,7 @@ use crate::{
struct SourceContextInner {
component_context: ComponentContext,
forwarder: Forwarder,
event_buffer_pool: FixedSizeObjectPool<EventBuffer>,
event_buffer_pool: ElasticObjectPool<EventBuffer>,
memory_limiter: MemoryLimiter,
health_registry: HealthRegistry,
component_registry: ComponentRegistry,
Expand All @@ -32,7 +32,7 @@ impl SourceContext {
/// Creates a new `SourceContext`.
pub fn new(
component_context: ComponentContext, shutdown_handle: ComponentShutdownHandle, forwarder: Forwarder,
event_buffer_pool: FixedSizeObjectPool<EventBuffer>, memory_limiter: MemoryLimiter,
event_buffer_pool: ElasticObjectPool<EventBuffer>, memory_limiter: MemoryLimiter,
component_registry: ComponentRegistry, health_handle: Health, health_registry: HealthRegistry,
) -> Self {
Self {
Expand Down Expand Up @@ -78,7 +78,7 @@ impl SourceContext {
}

/// Gets a reference to the event buffer pool.
pub fn event_buffer_pool(&self) -> &FixedSizeObjectPool<EventBuffer> {
pub fn event_buffer_pool(&self) -> &ElasticObjectPool<EventBuffer> {
&self.inner.event_buffer_pool
}

Expand Down
8 changes: 4 additions & 4 deletions lib/saluki-core/src/components/transforms/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use saluki_health::{Health, HealthRegistry};

use crate::{
components::ComponentContext,
pooling::FixedSizeObjectPool,
pooling::ElasticObjectPool,
topology::interconnect::{EventBuffer, EventStream, Forwarder},
};

Expand All @@ -12,7 +12,7 @@ pub struct TransformContext {
component_context: ComponentContext,
forwarder: Forwarder,
event_stream: EventStream,
event_buffer_pool: FixedSizeObjectPool<EventBuffer>,
event_buffer_pool: ElasticObjectPool<EventBuffer>,
memory_limiter: MemoryLimiter,
health_handle: Option<Health>,
health_registry: HealthRegistry,
Expand All @@ -23,7 +23,7 @@ impl TransformContext {
/// Creates a new `TransformContext`.
pub fn new(
component_context: ComponentContext, forwarder: Forwarder, event_stream: EventStream,
event_buffer_pool: FixedSizeObjectPool<EventBuffer>, memory_limiter: MemoryLimiter,
event_buffer_pool: ElasticObjectPool<EventBuffer>, memory_limiter: MemoryLimiter,
component_registry: ComponentRegistry, health_handle: Health, health_registry: HealthRegistry,
) -> Self {
Self {
Expand Down Expand Up @@ -63,7 +63,7 @@ impl TransformContext {
}

/// Gets a reference to the event buffer pool.
pub fn event_buffer_pool(&self) -> &FixedSizeObjectPool<EventBuffer> {
pub fn event_buffer_pool(&self) -> &ElasticObjectPool<EventBuffer> {
&self.event_buffer_pool
}

Expand Down
Loading

0 comments on commit 9f2b116

Please sign in to comment.