Skip to content

Conversation

@danisharora099
Copy link
Collaborator

Problem / Description

Solution

Notes

  • Resolves
  • Related to

Checklist

  • Code changes are covered by unit tests.
  • Code changes are covered by e2e tests, if applicable.
  • Dogfooding has been performed, if feasible.
  • A test version has been published, if required.
  • All CI checks pass successfully.

*
* If no storage backend is available, this behaves like {@link MemLocalHistory}.
*/
export class PersistentHistory extends MemLocalHistory {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you extending another class instead of the interface? Avoid abstractions as a rule of thumb

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

extended so that we could get the implementations for the following functions without needing to reimplement:

 push(...items: ContentMessage[]): number;
  some(
    predicate: (
      value: ContentMessage,
      index: number,
      array: ContentMessage[]
    ) => unknown,
    thisArg?: any
  ): boolean;
  slice(start?: number, end?: number): ContentMessage[];
  find(
    predicate: (
      value: ContentMessage,
      index: number,
      obj: ContentMessage[]
    ) => unknown,
    thisArg?: any
  ): ContentMessage | undefined;
  findIndex(
    predicate: (
      value: ContentMessage,
      index: number,
      obj: ContentMessage[]
    ) => unknown,
    thisArg?: any
  ): number;

this.restore();
}

public override push(...items: ContentMessage[]): number {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, don't use abstraction. Its not worth the indirection you are bringing in

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

switched to composition!

}

private persist(): void {
if (!this.storage) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hum, does it make sense for it to be constructed without storage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we want the class to behave like MemLocalHistory if no storage is provided, right?

@danisharora099 danisharora099 force-pushed the feat/persistent_history branch from d7aa504 to 92dd0ba Compare November 20, 2025 21:27
@github-actions
Copy link

github-actions bot commented Nov 20, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 96.4 KB (+0.1% 🔺) 2 s (+0.1% 🔺) 1.1 s (+88.35% 🔺) 3 s
Waku Simple Light Node 147.55 KB (+0.04% 🔺) 3 s (+0.04% 🔺) 942 ms (+23.82% 🔺) 3.9 s
ECIES encryption 22.62 KB (0%) 453 ms (0%) 327 ms (+71.46% 🔺) 780 ms
Symmetric encryption 22 KB (0%) 440 ms (0%) 353 ms (+96.29% 🔺) 792 ms
DNS discovery 52.17 KB (0%) 1.1 s (0%) 841 ms (+124.81% 🔺) 1.9 s
Peer Exchange discovery 52.91 KB (0%) 1.1 s (0%) 363 ms (+71.43% 🔺) 1.5 s
Peer Cache Discovery 46.64 KB (0%) 933 ms (0%) 505 ms (+19.64% 🔺) 1.5 s
Privacy preserving protocols 77.27 KB (-0.01% 🔽) 1.6 s (-0.01% 🔽) 547 ms (-5.02% 🔽) 2.1 s
Waku Filter 79.72 KB (-0.01% 🔽) 1.6 s (-0.01% 🔽) 654 ms (+16.05% 🔺) 2.3 s
Waku LightPush 77.95 KB (-0.06% 🔽) 1.6 s (-0.06% 🔽) 545 ms (-11.15% 🔽) 2.2 s
History retrieval protocols 83.77 KB (+0.15% 🔺) 1.7 s (+0.15% 🔺) 596 ms (+15.25% 🔺) 2.3 s
Deterministic Message Hashing 28.98 KB (0%) 580 ms (0%) 263 ms (+11.55% 🔺) 843 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants