Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of StorageProvider events #37

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

jimmyaxod
Copy link
Contributor

In order to support things like S3 Sync, we need a simple event system to be able to send events from one part of Silo to another, allowing for the fact that StorageProviders may have been wrapped / changed etc by the consumer of Silo.

Example:

data := sources.NewMemory(1024*1024)

// In Silo

storage.AddEventListener(data, "sync_start", callback)

// Silo user code

metrics := modules.NewMetrics(data)

silo.DoSomethingWith(metrics)

// Back to silo

returned_data := storage.SendEvent(metrics, ….)

In this example, the callback registered against the storage "data" should get called when the event is triggered against metrics.

Copy link
Member

@ShivanshVij ShivanshVij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes look good to me, looks like for the most part you were adding the same function implementation to all of them. Might make sense to check the provider variable in its own struct, implement the function once, and then it'll get inherited by all the structs.

Not worth changing right now, but worth keeping in mind.

@jimmyaxod jimmyaxod merged commit 4b1cc14 into main Oct 24, 2024
4 checks passed
@jimmyaxod jimmyaxod deleted the jamesmoore/arch-160-silo-storage-events branch October 24, 2024 08:49
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants