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