summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-04-17 14:32:45 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-15 19:09:20 -0400
commit07af5f9aa8e4786d374c8099de7e972e56e545a1 (patch)
tree42c5cc1ebb0a60bd4c4149025a415cd8a482dce4
parent0daddb9b0b115ed01c07e09502d45a23d0532bac (diff)
sd_login: add a diagram, and a mention of Monitor to the package docs
-rw-r--r--sd_login/doc.go55
-rw-r--r--sd_login/logind_session.go2
-rw-r--r--sd_login/logind_user.go2
-rw-r--r--sd_login/util.go1
4 files changed, 60 insertions, 0 deletions
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)
/*