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

Dtab delete #239

Merged
merged 1 commit into from
Apr 8, 2016
Merged

Dtab delete #239

merged 1 commit into from
Apr 8, 2016

Conversation

adleong
Copy link
Member

@adleong adleong commented Apr 5, 2016

  • Add a delete method to the DtabStore interface
  • Update in-memory and zk stores to implement delete
  • Add a DELETE method to the http controller

Fixes #209

@adleong adleong self-assigned this Apr 5, 2016
* Deletes a dtab. Returns a DtabNamespaceDoesNotExistException if the
* namespace does not exist.
*/
def delete(ns: String): Future[Unit]
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

@gtcampbell
Copy link
Contributor

👍 this looks good to me, and should be easy to merge into my DtabStore work on #219.

Approved with PullApprove

@rmars
Copy link
Contributor

rmars commented Apr 6, 2016

⭐ lgtm!

Approved with PullApprove

Future.exception(new DtabNamespaceDoesNotExistException(ns))
}
}
}
Copy link
Member

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?

Copy link
Member Author

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.

@gtcampbell
Copy link
Contributor

Approved with PullApprove

dtabStatesMu.synchronized(dtabStates).filter {
case (key, value) => value.sample.isDefined
}.keySet
}
Copy link
Member

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)
}

@olix0r
Copy link
Member

olix0r commented Apr 7, 2016

@adleong adleong merged commit 9817644 into master Apr 8, 2016
@adleong adleong removed the reviewable label Apr 8, 2016
@adleong adleong deleted the alex/dtab-delete branch April 8, 2016 23:03
Tim-Brooks pushed a commit to Tim-Brooks/linkerd that referenced this pull request Dec 20, 2018
* 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]>
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.

None yet

4 participants