From 715aa435b7d12265cbc041fff126bc1f9f653984 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 27 Jul 2021 00:10:20 +0200 Subject: cleanup and docs --- skate/schema.go | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/skate/schema.go b/skate/schema.go index b69f206..7717f9f 100644 --- a/skate/schema.go +++ b/skate/schema.go @@ -512,8 +512,10 @@ func (b *BiblioRef) Reset() { b.TargetCSL = nil } -// Hash returns a string that will be the same, if source and target are -// equal; different otherwise. This can be used to detect duplicate links. +// LinkHash returns a string that will be the same, if source and target are +// equal; different otherwise. This can be used to detect duplicate links. This +// should always return a non-empty string, but would return an empty string, +// if it would fail. func (b *BiblioRef) LinkHash() string { switch { case b.SourceReleaseIdent != "" && b.TargetReleaseIdent != "": @@ -540,29 +542,6 @@ func (b *BiblioRef) LinkHash() string { } } -// ReleaseCluster, a list of match candidates. This is typically serialized as a -// single JSON line containing the match key and a list of release documents. -// -// Deprecated, since we are moving to a "two stream" generic "join" style -// processing. -type ReleaseCluster struct { - Key string `json:"k"` - Values []*Release `json:"v"` -} - -// OneNonRef returns the first non-reference release found in a cluster, or an -// error, if none has been found. This depends on converted references setting -// extra.skate.status to "ref" - we use this in mixed clusters (catalog entries -// and references converted into releases). -func (rc *ReleaseCluster) OneNonRef() (*Release, error) { - for _, re := range rc.Values { - if re.Extra.Skate.Status != "ref" { - return re, nil - } - } - return nil, fmt.Errorf("no reference/release found for cluster key: %v", rc.Key) -} - // MinimalCitations variant from // archive.org/details/wikipedia_citations_2020-07-14. Part of the naming was // already inconsistent. -- cgit v1.2.3