gitea源码

appstate.go 622B

123456789101112131415161718192021222324252627
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package system
  4. import "context"
  5. // StateStore is the interface to get/set app state items
  6. type StateStore interface {
  7. Get(ctx context.Context, item StateItem) error
  8. Set(ctx context.Context, item StateItem) error
  9. }
  10. // StateItem provides the name for a state item. the name will be used to generate filenames, etc
  11. type StateItem interface {
  12. Name() string
  13. }
  14. // AppState contains the state items for the app
  15. var AppState StateStore
  16. // Init initialize AppState interface
  17. func Init() error {
  18. AppState = &DBStore{}
  19. return nil
  20. }