Add Set and UniqueQueue implementations #1

Merged
lunny merged 7 commits from zeripath/levelqueue:add-set-commands into master 2020-01-18 05:41:16 +00:00
Contributor

Whilst looking at replacing the code.gitea.io/gitea/modules/sync.UniqueQueue and code.gitea.io/gitea/modules/sync.Table in Gitea with the new code.gitea.io/gitea/modules/queue.Queue. I realized it would nice to use the leveldb as a set holder.

  • Adds Set and UniqueQueue implementations.
  • Adds functions to create Queue, Set & UniqueQueue from an already open leveldb to allow for multiple queues in the same db if desired.
Whilst looking at replacing the `code.gitea.io/gitea/modules/sync.UniqueQueue` and `code.gitea.io/gitea/modules/sync.Table` in Gitea with the new `code.gitea.io/gitea/modules/queue.Queue`. I realized it would nice to use the leveldb as a set holder. * Adds Set and UniqueQueue implementations. * Adds functions to create Queue, Set & UniqueQueue from an already open leveldb to allow for multiple queues in the same db if desired.
Owner

So how do you want to use levelqueue like UniqueQueue once the PR merged?

And I think the PR needs some tests.

So how do you want to use `levelqueue` like `UniqueQueue` once the PR merged? And I think the PR needs some tests.
Author
Contributor

It'd allow me to add UniqueQueue features on top of this - although if you'd prefer I could actually make an unique queue from within this package?

Another option would be to create a func From(db leveldb.DB) then we can create a levelqueue from a given levelDB. (Perhaps even be able to stick a prefix on the keys - so you can have more than one queue from a db?)

~~It'd allow me to add UniqueQueue features on top of this - although if you'd prefer I could actually make an unique queue from within this package?~~ ~~Another option would be to create a `func From(db leveldb.DB)` then we can create a levelqueue from a given levelDB. (Perhaps even be able to stick a prefix on the keys - so you can have more than one queue from a db?)~~
Author
Contributor

I've just pushed an alternative up, with a new Set and UniqueQueue implementations.

I've just pushed an alternative up, with a new Set and UniqueQueue implementations.
zeripath changed title from Add set commands to Add Set and UniqueQueue implementations 2020-01-17 21:30:55 +00:00
lunny reviewed 2020-01-18 01:32:54 +00:00
Dismissed
@ -0,0 +1,184 @@
// Copyright 2020 Andrew Thornton. All rights reserved.
Owner

How about rename it to unique_queue.go?

How about rename it to `unique_queue.go`?
lunny approved these changes 2020-01-18 01:40:33 +00:00
Dismissed
lunny left a comment
Owner

Great! Thanks!

Great! Thanks!
lunny added the
feature
label 2020-01-18 01:41:57 +00:00
lunny added this to the 0.2.0 milestone 2020-01-18 01:42:28 +00:00
lunny closed this pull request 2020-01-18 05:41:16 +00:00
zeripath deleted branch add-set-commands 2020-01-18 07:29:53 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/levelqueue#1
No description provided.