code.gitea.io/gitea@v1.22.3/modules/indexer/internal/db/indexer.go (about) 1 // Copyright 2023 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package db 5 6 import ( 7 "context" 8 9 "code.gitea.io/gitea/modules/indexer/internal" 10 ) 11 12 var _ internal.Indexer = &Indexer{} 13 14 // Indexer represents a basic db indexer implementation 15 type Indexer struct{} 16 17 // Init initializes the indexer 18 func (i *Indexer) Init(_ context.Context) (bool, error) { 19 // Return true to indicate that the index was opened/existed. 20 // So that the indexer will not try to populate the index, the data is already there. 21 return true, nil 22 } 23 24 // Ping checks if the indexer is available 25 func (i *Indexer) Ping(_ context.Context) error { 26 // No need to ping database to check if it is available. 27 // If the database goes down, Gitea will go down, so nobody will care if the indexer is available. 28 return nil 29 } 30 31 // Close closes the indexer 32 func (i *Indexer) Close() { 33 // nothing to do 34 }