You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we've started to develop use cases for Pepr, it is becoming apparent that there are times when you need to share data between different Capabilities and CapabilityActions. After discussing several ways we might do this, @bburky@cmwylie19@bdw617@rjferguson21 and I landed on the general idea for persisting shared state within K8s and maintaining an automated watch system for changes. More thoughts and details are below:
Problem: we need to share data, and using K8s resource metadata exclusively is cumbersome and brittle. One option is to generate more K8s resources, which is more complex and slower and requires resource cleanup.
Idea: define a simple key-value store native to Pepr core and transparently available for users of the SDK. More details:
Leverage a K8s CRD/CR (PeprStore) for pepr to maintain key-value state data per-capability
A watcher for all PeprStore resources (watchers are batch operations) that updates the internal state of the object for read
A Store method available from Capabilities to bind data
This can be exported for sharing data between Capabilities
// Use the 'When' function to create a new Capability Action, 'Store' to persist dataconst{ When, Store }=HelloPepr;// Save some data to the storeStore.setItem("hello-pepr","Hello Pepr!");// Add an item to the storeStore.setItem("hello-pepr-2","Hello Pepr! I'm a second item!");// Read the data back from the storeconsole.log(Store.getItem("hello-pepr"));// Update the data in the storeStore.setItem("hello-pepr","Hello Pepr! I've been updated!");// Get the length of the storeconsole.log(Store.length);// Delete an item from the storeStore.removeItem("hello-pepr");// Clear the storeStore.clear();
As we've started to develop use cases for Pepr, it is becoming apparent that there are times when you need to share data between different Capabilities and CapabilityActions. After discussing several ways we might do this, @bburky @cmwylie19 @bdw617 @rjferguson21 and I landed on the general idea for persisting shared state within K8s and maintaining an automated watch system for changes. More thoughts and details are below:
Problem: we need to share data, and using K8s resource metadata exclusively is cumbersome and brittle. One option is to generate more K8s resources, which is more complex and slower and requires resource cleanup.
Idea: define a simple key-value store native to Pepr core and transparently available for users of the SDK. More details:
PeprStore
) for pepr to maintain key-value state data per-capabilityPeprStore
resources (watchers are batch operations) that updates the internal state of the object for readStore
method available fromCapabilities
to bind dataCapabilities
The text was updated successfully, but these errors were encountered: