Remove redundant prepared input APIs
This commit is contained in:
@@ -53,7 +53,6 @@ type Source struct {
|
|||||||
// ScriptoriumInputSourceDescriptor describes one validated Scriptorium input source.
|
// ScriptoriumInputSourceDescriptor describes one validated Scriptorium input source.
|
||||||
type ScriptoriumInputSourceDescriptor struct {
|
type ScriptoriumInputSourceDescriptor struct {
|
||||||
Source Source
|
Source Source
|
||||||
PreparedInput *PreparedInputSourceDescriptor
|
|
||||||
PreviousSession *PreviousSessionSourceDescriptor
|
PreviousSession *PreviousSessionSourceDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +170,6 @@ func DescribeScriptoriumInputSource(source string) (ScriptoriumInputSourceDescri
|
|||||||
if prepared, ok := DescribePreparedInputSource(trimmed); ok {
|
if prepared, ok := DescribePreparedInputSource(trimmed); ok {
|
||||||
return ScriptoriumInputSourceDescriptor{
|
return ScriptoriumInputSourceDescriptor{
|
||||||
Source: Source{ID: prepared.SourceID, Kind: SourceKindStableInput},
|
Source: Source{ID: prepared.SourceID, Kind: SourceKindStableInput},
|
||||||
PreparedInput: &prepared,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(trimmed, "narratio.previous_session.artifact") {
|
if strings.HasPrefix(trimmed, "narratio.previous_session.artifact") {
|
||||||
@@ -196,13 +194,6 @@ func DescribeScriptoriumInputSource(source string) (ScriptoriumInputSourceDescri
|
|||||||
return ScriptoriumInputSourceDescriptor{Source: classified}, nil
|
return ScriptoriumInputSourceDescriptor{Source: classified}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsStableInputSource reports whether source is a prepared stable input source
|
|
||||||
// available only to Scriptorium input resolution.
|
|
||||||
func IsStableInputSource(source string) bool {
|
|
||||||
_, ok := DescribePreparedInputSource(source)
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
|
||||||
var preparedInputSources = map[string]PreparedInputSourceDescriptor{
|
var preparedInputSources = map[string]PreparedInputSourceDescriptor{
|
||||||
SourceInputPlayers: {
|
SourceInputPlayers: {
|
||||||
SourceID: SourceInputPlayers,
|
SourceID: SourceInputPlayers,
|
||||||
|
|||||||
@@ -233,14 +233,6 @@ func TestDescribePreparedInputSource(t *testing.T) {
|
|||||||
if descriptor.SourceID != tt.source || descriptor.ManifestKind != tt.manifestKind || descriptor.Filename != tt.filename {
|
if descriptor.SourceID != tt.source || descriptor.ManifestKind != tt.manifestKind || descriptor.Filename != tt.filename {
|
||||||
t.Fatalf("DescribePreparedInputSource(%q) = %#v", tt.source, descriptor)
|
t.Fatalf("DescribePreparedInputSource(%q) = %#v", tt.source, descriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptoriumDescriptor, err := DescribeScriptoriumInputSource(tt.source)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("DescribeScriptoriumInputSource(%q) error = %v", tt.source, err)
|
|
||||||
}
|
|
||||||
if scriptoriumDescriptor.PreparedInput == nil || *scriptoriumDescriptor.PreparedInput != descriptor {
|
|
||||||
t.Fatalf("prepared input descriptor = %#v, want %#v", scriptoriumDescriptor.PreparedInput, descriptor)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user