Skip to content

Commit fff0a73

Browse files
authored
Merge pull request #971 from ellemouton/sql13Sessions5
[sql-13] sessions: set up for atomic session creation
2 parents 1a389d1 + aafeacd commit fff0a73

File tree

11 files changed

+260
-81
lines changed

11 files changed

+260
-81
lines changed

app/src/types/generated/lit-sessions_pb.d.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/lit-sessions_pb.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

litrpc/lit-autopilot.swagger.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,8 @@
662662
"STATE_CREATED",
663663
"STATE_IN_USE",
664664
"STATE_REVOKED",
665-
"STATE_EXPIRED"
665+
"STATE_EXPIRED",
666+
"STATE_RESERVED"
666667
],
667668
"default": "STATE_CREATED"
668669
},

litrpc/lit-sessions.pb.go

Lines changed: 33 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

litrpc/lit-sessions.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ enum SessionState {
9797
STATE_IN_USE = 1;
9898
STATE_REVOKED = 2;
9999
STATE_EXPIRED = 3;
100+
STATE_RESERVED = 4;
100101
}
101102

102103
message AddSessionResponse {

litrpc/lit-sessions.swagger.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@
521521
"STATE_CREATED",
522522
"STATE_IN_USE",
523523
"STATE_REVOKED",
524-
"STATE_EXPIRED"
524+
"STATE_EXPIRED",
525+
"STATE_RESERVED"
525526
],
526527
"default": "STATE_CREATED"
527528
},

proto/lit-sessions.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ enum SessionState {
9797
STATE_IN_USE = 1;
9898
STATE_REVOKED = 2;
9999
STATE_EXPIRED = 3;
100+
STATE_RESERVED = 4;
100101
}
101102

102103
message AddSessionResponse {

session/interface.go

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,37 @@ const (
2626
// State represents the state of a session.
2727
type State uint8
2828

29+
/*
30+
/---> StateExpired
31+
StateCreated ---
32+
\---> StateRevoked
33+
*/
34+
2935
const (
36+
// StateCreated is the state of a session once it has been fully
37+
// committed to the Store and is ready to be used. This is the first
38+
// state of a session.
3039
StateCreated State = 0
31-
StateInUse State = 1
40+
41+
// StateInUse is the state of a session that is currently being used.
42+
//
43+
// NOTE: this state is not currently used, but we keep it around for now
44+
// since old sessions might still have this state persisted.
45+
StateInUse State = 1
46+
47+
// StateRevoked is the state of a session that has been revoked before
48+
// its expiry date.
3249
StateRevoked State = 2
50+
51+
// StateExpired is the state of a session that has passed its expiry
52+
// date.
3353
StateExpired State = 3
54+
55+
// StateReserved is a temporary initial state of a session. On start-up,
56+
// any sessions in this state should be cleaned up.
57+
//
58+
// NOTE: this isn't used yet.
59+
StateReserved State = 4
3460
)
3561

3662
// MacaroonRecipe defines the permissions and caveats that should be used
@@ -195,5 +221,9 @@ type Store interface {
195221
CheckSessionGroupPredicate(groupID ID,
196222
fn func(s *Session) bool) (bool, error)
197223

224+
// DeleteReservedSessions deletes all sessions that are in the
225+
// StateReserved state.
226+
DeleteReservedSessions() error
227+
198228
IDToGroupIndex
199229
}

0 commit comments

Comments
 (0)