2020-10-12 23:58:34 -04:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 13:20:29 -05:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-10-12 23:58:34 -04:00
|
|
|
|
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
2022-11-30 08:39:02 -05:00
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"net/url"
|
|
|
|
"os"
|
2020-10-12 23:58:34 -04:00
|
|
|
)
|
|
|
|
|
2022-11-30 08:39:02 -05:00
|
|
|
var uninitializedStorage = discardStorage("uninitialized storage")
|
|
|
|
|
|
|
|
type discardStorage string
|
|
|
|
|
|
|
|
func (s discardStorage) Open(_ string) (Object, error) {
|
|
|
|
return nil, fmt.Errorf("%s", s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s discardStorage) Save(_ string, _ io.Reader, _ int64) (int64, error) {
|
|
|
|
return 0, fmt.Errorf("%s", s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s discardStorage) Stat(_ string) (os.FileInfo, error) {
|
|
|
|
return nil, fmt.Errorf("%s", s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s discardStorage) Delete(_ string) error {
|
|
|
|
return fmt.Errorf("%s", s)
|
|
|
|
}
|
|
|
|
|
2024-10-31 11:28:25 -04:00
|
|
|
func (s discardStorage) URL(_, _ string, _ url.Values) (*url.URL, error) {
|
2022-11-30 08:39:02 -05:00
|
|
|
return nil, fmt.Errorf("%s", s)
|
|
|
|
}
|
|
|
|
|
2023-03-13 06:23:51 -04:00
|
|
|
func (s discardStorage) IterateObjects(_ string, _ func(string, Object) error) error {
|
2022-11-30 08:39:02 -05:00
|
|
|
return fmt.Errorf("%s", s)
|
|
|
|
}
|