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

Spike: KeyValue repository #1448

Closed
1 of 3 tasks
bajtos opened this issue Jun 21, 2018 · 4 comments
Closed
1 of 3 tasks

Spike: KeyValue repository #1448

bajtos opened this issue Jun 21, 2018 · 4 comments

Comments

@bajtos
Copy link
Member

bajtos commented Jun 21, 2018

Timeboxed to 3 days

See #1447

So far, LB4 persistence story is all about CRUD. Key-value stores are another common scenario we should support. LoopBack 3.x introduced KeyValue API and Redis + eXtremeScale connectors. For LoopBack 4, we need to add Repository implementations for KeyValue API and verify that all pieces work together as expected.

  • Add necessary Repository APIs and implementations
  • Verify the use case against real Redis instance
  • Documentation, example app, blog post

LB 3.x resources for reference:

Proposed repository API:

interface KeyFilter {
  match: string;
};

interface KeyValueRepository<T> {
  get(key: string, options?: object): Promise<T>;
  set(key: string, value: T, options: object & {ttl?: number}): Promise<void>;
  expire(key: string, ttl: number, options?: object): Promise<void>;
  ttl(key: string, options?: object): Promise<number>; // find a better name than ttl?

  iterateKeys(filter: KeyFilter, options?: object): AsyncIterator<T>;
  keys(filter: KeyFilter, options?: object): Promise<T[]>;
}

Acceptance criteria

  • Write a throw-away spike to find out how much work is needed to provide KeyValueRepository as an addition to EntityCrudRepository. Discuss the proposed implementation in a pull request, get it approved at least by @raymondfeng and @bajtos Raymond went ahead and opened a pull request providing a full implementation - see feat(repository): add KVRepository impl using legacy juggler #1539
  • Identify follow-up stories that are needed to make this functionality happen. Get the list approved before creating actual GitHub issues
  • Create a list of GitHub issues, make sure to include acceptance criteria in each one. Issues should be assigned to "Core-GA" release and Epic [Epic] KeyValue repository #1447.
@bajtos bajtos added the spike label Jun 21, 2018
@jannyHou
Copy link
Contributor

timebox to 3 days.

@bajtos
Copy link
Member Author

bajtos commented Aug 13, 2018

@raymondfeng your pull request #1539 is a great step towards a working KeyValue implementation. However, the pull request addresses only the runtime part. IMO, to make this feature easy to use, we need to consider the rest of the story too:

  • documentation on loopback.io
  • support in boot (if needed?)
  • support in CLI
  • etc.

@raymondfeng
Copy link
Contributor

raymondfeng commented Aug 29, 2018

Adding docs - #1654

We'll handle the boot/CLI as part of lb4 repository (#1588)

@bajtos bajtos added this to the September Milestone milestone Aug 30, 2018
@raymondfeng
Copy link
Contributor

I'm closing this spike as no other github issues need to be opened.

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

No branches or pull requests

3 participants