feat: publish v1.0.0-rc.36-custom.1
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
This commit is contained in:
commit
bb7968b612
2381 files changed
+551494
No files matched your search
@@ -0,0 +1,63 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
"github.com/QuantumNous/new-api/setting/system_setting"
|
||||
"github.com/QuantumNous/new-api/types"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// StoredArtifactRef describes a persisted artifact object. No reference is
|
||||
// produced until a concrete storage backend is implemented.
|
||||
type StoredArtifactRef struct {
|
||||
Backend string
|
||||
Bucket string
|
||||
ObjectKey string
|
||||
MimeType string
|
||||
Size int64
|
||||
}
|
||||
|
||||
// TaskArtifactStore is the persistence boundary for generated artifact bytes.
|
||||
// types.TaskArtifact is re-exported by relay/channel as channel.TaskArtifact.
|
||||
type TaskArtifactStore interface {
|
||||
Enabled() bool
|
||||
Resolve(task *model.Task, artifactKey string) (*StoredArtifactRef, error)
|
||||
Persist(ctx context.Context, task *model.Task, artifact types.TaskArtifact, content io.Reader) (*StoredArtifactRef, error)
|
||||
Serve(c *gin.Context, task *model.Task, ref *StoredArtifactRef) error
|
||||
}
|
||||
|
||||
var ErrTaskArtifactStoreDisabled = errors.New("task artifact store is disabled")
|
||||
|
||||
type disabledArtifactStore struct{}
|
||||
|
||||
func (disabledArtifactStore) Enabled() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (disabledArtifactStore) Resolve(*model.Task, string) (*StoredArtifactRef, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (disabledArtifactStore) Persist(context.Context, *model.Task, types.TaskArtifact, io.Reader) (*StoredArtifactRef, error) {
|
||||
return nil, ErrTaskArtifactStoreDisabled
|
||||
}
|
||||
|
||||
func (disabledArtifactStore) Serve(*gin.Context, *model.Task, *StoredArtifactRef) error {
|
||||
return ErrTaskArtifactStoreDisabled
|
||||
}
|
||||
|
||||
var taskArtifactStore TaskArtifactStore = &disabledArtifactStore{}
|
||||
|
||||
func init() {
|
||||
_ = system_setting.LoadTaskArtifactStoreConfig()
|
||||
}
|
||||
|
||||
// GetTaskArtifactStore returns the process-wide artifact storage backend. This
|
||||
// release always returns the disabled implementation.
|
||||
func GetTaskArtifactStore() TaskArtifactStore {
|
||||
return taskArtifactStore
|
||||
}
|
||||
Reference in new issue
Block a user