-
Notifications
You must be signed in to change notification settings - Fork 505
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
Dtab delete #239
Dtab delete #239
Conversation
* Deletes a dtab. Returns a DtabNamespaceDoesNotExistException if the | ||
* namespace does not exist. | ||
*/ | ||
def delete(ns: String): Future[Unit] |
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.
idle question only tangentially related to this review: would it be useful to have the various CRUD operations return Future[VersionedDtab] rather than Future[Unit]? That way, the caller knows the state/version of the object as of its creation/update/deletion, rather than having to call a get() later.
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.
There's some discussion of that here: #207. Ideally yes, though the cost to implementing this depends on the backing store.
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.
Got it, thanks for the link. FWIW, k8s also gives us that functionality for free.
👍 this looks good to me, and should be easy to merge into my DtabStore work on #219. |
Future.exception(new DtabNamespaceDoesNotExistException(ns)) | ||
} | ||
} | ||
} |
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.
Should we actually remove it from the state cache after updating it? Won't it continue to be returned from list()
otherwise?
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.
I don't think we want to remove this from the cache. Anyone observing the discarded state var will no longer receive updates (eg if the namespace is recreated). Instead, I fixed list
to only list non-empty namespaces.
dtabStatesMu.synchronized(dtabStates).filter { | ||
case (key, value) => value.sample.isDefined | ||
}.keySet | ||
} |
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.
tioli:
I generally prefer to avoid nesting -- easier to understand:
val v = ..
Future.value(v)
might write this as:
def list(): Future[Set[String]] = {
val keys = dtabStatesMu.synchronized(dtabStates).collect {
case (k, v) if v.sample.isDefined => k
}
Future.value(keys.toSet)
}
⭐ |
630622a
to
4370e07
Compare
* Add -log-level flag for install and inject commands Signed-off-by: Kevin Lingerfelt <[email protected]> * Turn off all CLI logging by default, rename inject and install flags Signed-off-by: Kevin Lingerfelt <[email protected]> * Re-enable color logging Signed-off-by: Kevin Lingerfelt <[email protected]>
delete
method to theDtabStore
interfaceFixes #209