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