From 07af5f9aa8e4786d374c8099de7e972e56e545a1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 17 Apr 2017 14:32:45 -0400 Subject: sd_login: add a diagram, and a mention of Monitor to the package docs --- sd_login/doc.go | 55 ++++++++++++++++++++++++++++++++++++++++++++++ sd_login/logind_session.go | 2 ++ sd_login/logind_user.go | 2 ++ sd_login/util.go | 1 + 4 files changed, 60 insertions(+) diff --git a/sd_login/doc.go b/sd_login/doc.go index 7bef4fe..2e083ad 100644 --- a/sd_login/doc.go +++ b/sd_login/doc.go @@ -42,4 +42,59 @@ // user if it is not part of a session. This "belonging" is // separate accounting by the cgroup manager; it is NOT the same // as the EUID/RUID. +// +// How these relations look in the types implemented here: +// +// ............................................ +// . . +// . +-------------+ . +// . | MachineName | . +// . +-------------+ . +// . ^ . +// . | . +// . |GetMachine() . +// . | . +// . ^ . +// . +-----------+ . +// . | ProcessID | . +// . +-----------+ . +// . v v . +// . | | . +// . GetSession() | | GetOwner() . +// . ,--------' '-------, . +// . | | . +// . v v . +// . +-------------+ GetUser() +--------+ . +// . | SessionName |>--------->| UserID | . +// . +-------------+ +--------+ . +// . v^^ ^ GetSessions() v . +// . ||| `---------------' . +// . ||| . +// . GetSeat()||GetSessions() . +// . |||GetActive() . +// . v^^ . +// . +----------+ . +// . | SeatName | . +// . +----------+ . +// . . +// ............................................ +// +// Missing from the above diagram: +// +// - As an optimization, SeatName.GetSessions() and .GetActive() +// return both the session name, and the user ID that owns the +// session. This is equivalent to just calling .GetUser() on the +// returned session. +// +// - There is also a UserID.GetSeats() that is equivalent to calling +// UserID.GetSessions(), and calling .GetSeat() on each returned +// session. +// +// TODO: Better describe how machines fit in; the high-level +// description doesn't really match the interface exposed (as evident +// by a glance at the diagram). +// +// Finally, if you would like to perform some action whenever a +// machine, seat, session, or logged-in-user is added or removed, +// there is a Monitor that will help you avoid polling. package sd_login diff --git a/sd_login/logind_session.go b/sd_login/logind_session.go index c48d619..f4e5cbf 100644 --- a/sd_login/logind_session.go +++ b/sd_login/logind_session.go @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// TODO + package sd_login import ( diff --git a/sd_login/logind_user.go b/sd_login/logind_user.go index fe908e0..46f7382 100644 --- a/sd_login/logind_user.go +++ b/sd_login/logind_user.go @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// TODO + package sd_login import ( diff --git a/sd_login/util.go b/sd_login/util.go index 5a8e58d..a49de76 100644 --- a/sd_login/util.go +++ b/sd_login/util.go @@ -120,6 +120,7 @@ func parse_boolean(v string) (bool, error) { } } +// TODO func parse_env_file(filename string) (map[string]string, error) /* -- cgit v1.1-4-g5e80