Documentation
¶
Overview ¶
Package objects owns the values used to describe persisted DRS records and their checksum-derived views. It deliberately has no dependency on the generated HTTP contract: adapters translate at the boundary.
Index ¶
- Variables
- func AccessMethodID(accessType, accessURL string) string
- func AccessResources(obj *Record) []string
- func CanonicalSHA256(checksums []Checksum) (string, bool)
- func CleanToBasename(name string) string
- func LooksLikeSHA256(v string) bool
- func NormalizeChecksum(cs string) string
- func NormalizeChecksumType(checksumType string) string
- func NormalizeNameAliases(primary string, aliases []string) []string
- func NormalizeSHA256Query(value string) (string, bool)
- func ParseHashQuery(rawHash string, rawType string) (string, string)
- func RecordHasChecksumTypeAndValue(obj Record, hashType, hashValue string) bool
- func SHA256Values(checksums []Checksum) []string
- func ValidateCanonicalSHA256(checksums []Checksum) (string, bool, error)
- type AccessAuthorizations
- type AccessMethod
- type AccessURL
- type Candidate
- type CanonicalContent
- type Checksum
- type Content
- type ContentID
- type Record
- type RecordID
- type RegistrationMergeInput
- type RegistrationMergeResult
Constants ¶
This section is empty.
Variables ¶
var ErrAccessMethodsRequired = errors.New("candidate must include at least one access method with a non-empty url")
var ErrConflictingSHA256 = errors.New("conflicting sha256 values provided")
var ErrNoValidSHA256 = errors.New("no valid sha256 values provided")
Functions ¶
func AccessMethodID ¶
AccessMethodID is stable for a type/URL pair and is safe to expose as the selector used by the DRS access endpoint.
func AccessResources ¶
AccessResources returns the normalized controlled-access resources attached to a record.
func CanonicalSHA256 ¶
func CleanToBasename ¶
CleanToBasename extracts a portable basename from either Windows or Unix path syntax.
func LooksLikeSHA256 ¶
func NormalizeChecksum ¶
func NormalizeChecksumType ¶
func NormalizeNameAliases ¶
func NormalizeSHA256Query ¶
func SHA256Values ¶
Types ¶
type AccessAuthorizations ¶
type AccessAuthorizations struct {
BearerAuthIssuers *[]string `json:"bearer_auth_issuers,omitempty"`
DrsObjectId *string `json:"drs_object_id,omitempty"`
PassportAuthIssuers *[]string `json:"passport_auth_issuers,omitempty"`
SupportedTypes *[]string `json:"supported_types,omitempty"`
}
AccessAuthorizations describes optional authorization issuers attached to an access method. The fields mirror the DRS contract without importing it.
type AccessMethod ¶
type AccessMethod struct {
AccessId *string `json:"access_id,omitempty"`
AccessUrl *AccessURL `json:"access_url,omitempty"`
Authorizations *AccessAuthorizations `json:"authorizations,omitempty"`
Available *bool `json:"available,omitempty"`
Cloud *string `json:"cloud,omitempty"`
Region *string `json:"region,omitempty"`
Type string `json:"type"`
}
AccessMethod describes one physical access route for a record.
type Candidate ¶
type Candidate struct {
AccessMethods *[]AccessMethod `json:"access_methods,omitempty"`
Aliases *[]string `json:"aliases,omitempty"`
Checksums *[]Checksum `json:"checksums,omitempty"`
Contents *[]Content `json:"contents,omitempty"`
ControlledAccess *[]string `json:"controlled_access,omitempty"`
Description *string `json:"description,omitempty"`
MimeType *string `json:"mime_type,omitempty"`
Name *string `json:"name,omitempty"`
Size *int64 `json:"size,omitempty"`
}
Candidate is the plain request value accepted by object registration and LFS metadata staging. HTTP adapters translate generated request models into this value before it crosses into core or persistence.
type CanonicalContent ¶
CanonicalContent is the prepared same-content view returned by checksum-aware reads. Record is the merged presentation and Records keeps the physical replicas available to callers that need them.
type Checksum ¶
Checksum is the persistence-independent checksum value carried by a record.
type Content ¶
type Content struct {
Contents *[]Content `json:"contents,omitempty"`
DrsUri *[]string `json:"drs_uri,omitempty"`
Id *string `json:"id,omitempty"`
Name string `json:"name"`
}
Content is a nested bundle entry. It is intentionally independent of the generated API's ContentsObject so persistence and object services can share it without importing HTTP code.
type Record ¶
type Record struct {
Id RecordID `json:"id"`
AccessMethods *[]AccessMethod `json:"access_methods,omitempty"`
Aliases *[]string `json:"aliases,omitempty"`
Authorizations map[string][]string `json:"-"`
Checksums []Checksum `json:"checksums"`
Contents *[]Content `json:"contents,omitempty"`
ControlledAccess *[]string `json:"controlled_access,omitempty"`
CreatedTime time.Time `json:"created_time"`
Description *string `json:"description,omitempty"`
MimeType *string `json:"mime_type,omitempty"`
Name *string `json:"name,omitempty"`
NameAliases []string `json:"name_aliases,omitempty"`
Properties map[string]json.RawMessage `json:"-"`
Project string `json:"project"`
PublicRead bool `json:"-"`
PublicReadPolicyKnown bool `json:"-"`
SelfUri string `json:"self_uri"`
Size int64 `json:"size"`
UpdatedTime *time.Time `json:"updated_time,omitempty"`
Version *string `json:"version,omitempty"`
}
Record is one physical object record. Extension fields are retained only while the value is in memory; SQL hydration preserves the historical behavior and does not claim to persist unknown properties.
func CandidateToRecord ¶
CandidateToRecord converts an HTTP-neutral registration candidate into a persisted record. Candidate.Contents is intentionally not copied: the historical catalog contract stores object contents separately from the registration record.
func EnforceCanonicalProjectScope ¶
EnforceCanonicalProjectScope adds the exact project resource to a record's controlled-access set. It is the domain-side normalization used by record adapters before registration or overwrite.
type RecordID ¶
type RecordID string
RecordID identifies one physical persisted record. Two records may refer to the same content while retaining distinct record IDs.
type RegistrationMergeInput ¶
type RegistrationMergeInput struct {
ExistingName string
ExistingVersion string
ExistingDescription string
ExistingSize int64
ExistingUpdated time.Time
IncomingName string
IncomingVersion string
IncomingDescription string
IncomingSize int64
IncomingUpdated time.Time
IncomingResources []string
CurrentResources []string
}
RegistrationMergeInput is the state loaded by a content registration transaction and the metadata supplied by the incoming registration. Resource slices select metadata replacement semantics; authorization remains the caller's responsibility.
type RegistrationMergeResult ¶
type RegistrationMergeResult struct {
Name string
Version string
Description string
Size int64
Updated time.Time
NameAlias string
}
RegistrationMergeResult contains the merged metadata and, when needed, the name alias that must be inserted by the adapter. It is deliberately free of SQL, context, and authorization side effects.
func MergeRegistrationMetadata ¶
func MergeRegistrationMetadata(input RegistrationMergeInput) RegistrationMergeResult
MergeRegistrationMetadata applies registration-specific merge semantics. This is intentionally separate from MergeRecordUpdate: registration may replace metadata only for one overlapping current resource, while ordinary record updates have different field and authorization semantics.