Documentation
¶
Overview ¶
Package repository defines provider-qualified research repository contracts.
It intentionally contains no network client interface. Shared behavior is promoted only when the concrete OSF and Zenodo descriptors can state its support level and provider-specific constraints without losing semantics.
Index ¶
- Variables
- type Capability
- type CapabilitySupport
- type CapabilitySupportError
- type Checksum
- type Contract
- type Lifecycle
- type LifecycleState
- type Link
- type NativeMetadata
- type Permission
- type Permissions
- type Provider
- type QualifiedID
- type RecordEnvelope
- type ResourceKind
- type SupportLevel
- type VersionIdentity
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedCapability identifies operations absent from a provider. ErrUnsupportedCapability = errors.New("repository capability is unsupported") // ErrPartialCapability identifies operations requiring provider-specific handling. ErrPartialCapability = errors.New("repository capability is only partially supported") )
var ( // ErrInvalidIdentity identifies malformed provider-qualified identities. ErrInvalidIdentity = errors.New("invalid provider-qualified identity") )
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability string
Capability identifies a provider operation without implying support.
const ( CapabilityFileDelete Capability = "files.delete" CapabilityFileDownload Capability = "files.download" CapabilityFileList Capability = "files.list" CapabilityFileUpload Capability = "files.upload" CapabilityPublish Capability = "lifecycle.publish" CapabilityMetadataUpdate Capability = "metadata.update" CapabilityOAIHarvest Capability = "oai.harvest" CapabilityRecordCreate Capability = "records.create" CapabilityRecordDelete Capability = "records.delete" CapabilityRecordGet Capability = "records.get" CapabilityRecordSearch Capability = "records.search" CapabilityRecordUpdate Capability = "records.update" CapabilityVersionCreate Capability = "versions.create" )
func AllCapabilities ¶
func AllCapabilities() []Capability
AllCapabilities returns a copy of the complete shared vocabulary.
type CapabilitySupport ¶
type CapabilitySupport struct {
Capability Capability `json:"capability"`
Level SupportLevel `json:"level"`
Constraints []string `json:"constraints,omitempty"`
}
CapabilitySupport describes a concrete provider's operation semantics.
type CapabilitySupportError ¶
type CapabilitySupportError struct {
Provider Provider
Capability Capability
Level SupportLevel
Constraints []string
}
CapabilitySupportError provides capability-aware user guidance.
func (*CapabilitySupportError) Error ¶
func (e *CapabilitySupportError) Error() string
func (*CapabilitySupportError) Unwrap ¶
func (e *CapabilitySupportError) Unwrap() error
type Contract ¶
type Contract struct {
Provider Provider `json:"provider"`
ModelVersion int `json:"model_version"`
Capabilities []CapabilitySupport `json:"capabilities"`
}
Contract is a concrete provider capability descriptor, not a client interface.
func OSFContract ¶
func OSFContract() Contract
OSFContract reports reviewed OSF behavior without changing the existing API client.
func ZenodoContract ¶
func ZenodoContract() Contract
ZenodoContract reports behavior evidenced by the pinned Zenodo snapshot.
func (Contract) Require ¶
func (contract Contract) Require(capability Capability) error
Require succeeds only for fully supported behavior.
func (Contract) Support ¶
func (contract Contract) Support(capability Capability) CapabilitySupport
Support returns explicit support details, including for unknown capabilities.
type Lifecycle ¶
type Lifecycle struct {
Common LifecycleState `json:"common"`
Native string `json:"native"`
}
Lifecycle combines a workflow-oriented state with the lossless native state.
type LifecycleState ¶
type LifecycleState string
LifecycleState is a deliberately small common lifecycle vocabulary.
const ( LifecycleActive LifecycleState = "active" LifecycleDraft LifecycleState = "draft" LifecycleEmbargoed LifecycleState = "embargoed" LifecyclePublished LifecycleState = "published" LifecycleRegistered LifecycleState = "registered" LifecycleWithdrawn LifecycleState = "withdrawn" )
type NativeMetadata ¶
type NativeMetadata struct {
// contains filtered or unexported fields
}
NativeMetadata retains a provider's original metadata representation.
func NewNativeMetadata ¶
func NewNativeMetadata(mediaType string, data []byte) (NativeMetadata, error)
NewNativeMetadata copies and validates provider-native metadata.
func (NativeMetadata) Bytes ¶
func (m NativeMetadata) Bytes() []byte
Bytes returns an independent copy of the provider-native metadata.
func (NativeMetadata) MarshalJSON ¶
func (m NativeMetadata) MarshalJSON() ([]byte, error)
MarshalJSON encodes native bytes losslessly using JSON's base64 byte encoding.
func (NativeMetadata) MediaType ¶
func (m NativeMetadata) MediaType() string
MediaType reports the provider-native metadata media type.
func (*NativeMetadata) UnmarshalJSON ¶
func (m *NativeMetadata) UnmarshalJSON(data []byte) error
UnmarshalJSON restores and validates a lossless native metadata envelope.
type Permission ¶
type Permission string
Permission represents knowledge about a concrete provider permission.
const ( PermissionAllowed Permission = "allowed" PermissionDenied Permission = "denied" PermissionUnknown Permission = "unknown" PermissionUnsupported Permission = "unsupported" )
type Permissions ¶
type Permissions struct {
Read Permission `json:"read"`
Write Permission `json:"write"`
Delete Permission `json:"delete"`
Publish Permission `json:"publish"`
}
Permissions preserves action-specific authorization knowledge.
type QualifiedID ¶
type QualifiedID struct {
Provider Provider `json:"provider"`
Kind ResourceKind `json:"kind"`
NativeID string `json:"native_id"`
}
QualifiedID keeps a native identifier attached to its provider and kind.
func ParseQualifiedID ¶
func ParseQualifiedID(value string) (QualifiedID, error)
ParseQualifiedID parses a key created by QualifiedID.Key.
func (QualifiedID) Key ¶
func (id QualifiedID) Key() (string, error)
Key returns an unambiguous, reversible provider-qualified key.
func (QualifiedID) Validate ¶
func (id QualifiedID) Validate() error
Validate checks that the identity is explicit and recognized.
type RecordEnvelope ¶
type RecordEnvelope struct {
Identity QualifiedID `json:"identity"`
Title string `json:"title,omitempty"`
Lifecycle Lifecycle `json:"lifecycle"`
NativeMetadata NativeMetadata `json:"native_metadata"`
Links []Link `json:"links,omitempty"`
Permissions Permissions `json:"permissions"`
Version VersionIdentity `json:"version,omitempty"`
Checksums []Checksum `json:"checksums,omitempty"`
}
RecordEnvelope contains normalized workflow fields and lossless native data.
func (RecordEnvelope) Validate ¶
func (record RecordEnvelope) Validate() error
Validate checks the common envelope without interpreting native metadata.
type ResourceKind ¶
type ResourceKind string
ResourceKind preserves a provider resource's semantic kind.
const ( KindComponent ResourceKind = "component" KindDeposition ResourceKind = "deposition" KindFile ResourceKind = "file" KindProject ResourceKind = "project" KindRecord ResourceKind = "record" KindRegistration ResourceKind = "registration" )
type SupportLevel ¶
type SupportLevel string
SupportLevel distinguishes full, constrained, and absent behavior.
const ( SupportPartial SupportLevel = "partial" SupportSupported SupportLevel = "supported" SupportUnsupported SupportLevel = "unsupported" )
type VersionIdentity ¶
type VersionIdentity struct {
NativeVersionID string `json:"native_version_id,omitempty"`
DOI string `json:"doi,omitempty"`
ConceptDOI string `json:"concept_doi,omitempty"`
}
VersionIdentity keeps native and persistent version identifiers separate.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conformancetest provides reusable repository contract assertions.
|
Package conformancetest provides reusable repository contract assertions. |