mirror of
https://github.com/mudler/LocalAI.git
synced 2026-11-06 04:23:15 -05:00
feat(addons): let a caller ask whether the grants store is usable
View hides a closed or doubtful store behind an empty document, which would drop the deny rules kept in it. A caller that must fail closed asks Usable first. Assisted-by: Claude:claude-sonnet-5-5 go
This commit is contained in:
1 file changed
+9
@@ -130,6 +130,15 @@ func (s *Store) usable() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Usable reports whether the store answers: it is neither closed nor in doubt
|
||||
// about its last write. A caller that must fail closed asks it before it
|
||||
// trusts View, which hides the failure behind an empty document.
|
||||
func (s *Store) Usable() error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.usable()
|
||||
}
|
||||
|
||||
// Snapshot returns a copy of the current document.
|
||||
func (s *Store) Snapshot(ctx context.Context) (Snapshot, error) {
|
||||
s.mu.Lock()
|
||||
|
||||
Reference in new issue
Block a user