-
Notifications
You must be signed in to change notification settings - Fork 15
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
Da service backend #381
Da service backend #381
Conversation
164429d
to
87d4d99
Compare
Codecov ReportPatch has no changes to coverable lines. ❗ Your organization needs to install the Codecov GitHub app to enable full functionality. 📢 Thoughts on this report? Let us know!. |
pub type BlobHasher<T> = fn(&T) -> <T as Blob>::Hash; | ||
|
||
pub trait Blob { | ||
const HASHER: BlobHasher<Self>; | ||
type Hash: Hash + Eq + Clone; | ||
fn hash(&self) -> Self::Hash { | ||
Self::HASHER(self) | ||
} | ||
fn as_bytes(&self) -> Bytes; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be expanded later if needed when we know more about how would it looks.
|
||
pub fn pending_blobs(&self) -> Box<dyn Iterator<Item = B> + Send> { | ||
// bypass lifetime | ||
let blobs: Vec<_> = self.0.iter().map(|t| t.1).collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moka
clones by default.
// can we leverage this to evict really old blobs? | ||
.time_to_idle(evicting_period) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in https://github.com/logos-co/nomos-node/pull/376/files#r1317083701, the expectation is that the outer service retrieves pending blobs from this service, does something with those blobs, and after that, requests removing those blobs? If so, it seems it's okay to use time_to_idle
. This will reset eviction timers whenever pending_blobs()
is called, but I guess it's okay if it wouldn't take too long for the outer service to process and remove blobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. So the idea here is that. Either a blob is pending for the whole life until is added into a block. Or is removed. (that is why is using the same evicting period as the time to live). But it would make sense that if it is not included it dies as well after some time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear structure to understand! even though I can't now imagine the full scenario about how we'll use this service. I'd like to participate in this topic soon, even for small stuff, to understand our expectation clearly.
No description provided.