code.gitea.io/gitea@v1.19.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  // StateStore is the interface to get/set app state items
     7  type StateStore interface {
     8  	Get(item StateItem) error
     9  	Set(item StateItem) error
    10  }
    11  
    12  // StateItem provides the name for a state item. the name will be used to generate filenames, etc
    13  type StateItem interface {
    14  	Name() string
    15  }
    16  
    17  // AppState contains the state items for the app
    18  var AppState StateStore
    19  
    20  // Init initialize AppState interface
    21  func Init() error {
    22  	AppState = &DBStore{}
    23  	return nil
    24  }