code.gitea.io/gitea@v1.22.3/modules/storage/helper.go (about) 1 // Copyright 2020 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package storage 5 6 import ( 7 "fmt" 8 "io" 9 "net/url" 10 "os" 11 ) 12 13 var uninitializedStorage = discardStorage("uninitialized storage") 14 15 type discardStorage string 16 17 func (s discardStorage) Open(_ string) (Object, error) { 18 return nil, fmt.Errorf("%s", s) 19 } 20 21 func (s discardStorage) Save(_ string, _ io.Reader, _ int64) (int64, error) { 22 return 0, fmt.Errorf("%s", s) 23 } 24 25 func (s discardStorage) Stat(_ string) (os.FileInfo, error) { 26 return nil, fmt.Errorf("%s", s) 27 } 28 29 func (s discardStorage) Delete(_ string) error { 30 return fmt.Errorf("%s", s) 31 } 32 33 func (s discardStorage) URL(_, _ string) (*url.URL, error) { 34 return nil, fmt.Errorf("%s", s) 35 } 36 37 func (s discardStorage) IterateObjects(_ string, _ func(string, Object) error) error { 38 return fmt.Errorf("%s", s) 39 }