MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / persistLocked

Method persistLocked

apps/server/internal/httpserver/security.go:82–93  ·  view source on GitHub ↗

persistLocked writes the current sessions to disk (mode 0600). The caller must hold s.mu. Best-effort: a write failure only means sessions won't survive the next restart, so it is logged but not fatal.

()

Source from the content-addressed store, hash-verified

80// hold s.mu. Best-effort: a write failure only means sessions won't survive the
81// next restart, so it is logged but not fatal.
82func (s *sessionStore) persistLocked() {
83 if s.path == "" {
84 return
85 }
86 data, err := json.Marshal(s.sessions)
87 if err != nil {
88 return
89 }
90 if err := os.WriteFile(s.path, data, 0o600); err != nil {
91 log.Printf("sessions: could not persist to %q: %v", s.path, err)
92 }
93}
94
95func (s *sessionStore) create() (string, time.Time, error) {
96 buf := make([]byte, 32)

Callers 3

createMethod · 0.95
deleteMethod · 0.95
deleteAllMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected