1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
14 "github.com/klauspost/pgzip"
15 "golang.org/x/crypto/blake2b"
18 type CompactGenome struct {
20 Variants []tileVariantID
25 type CompactSequence struct {
27 TileSequences map[string][]tileLibRef
30 type TileVariant struct {
34 Blake2b [blake2b.Size256]byte
38 type LibraryEntry struct {
40 CompactGenomes []CompactGenome
41 CompactSequences []CompactSequence
42 TileVariants []TileVariant
45 func ReadCompactGenomes(rdr io.Reader, gz bool) ([]CompactGenome, error) {
46 var ret []CompactGenome
47 err := DecodeLibrary(rdr, gz, func(ent *LibraryEntry) error {
48 ret = append(ret, ent.CompactGenomes...)
54 func DecodeLibrary(rdr io.Reader, gz bool, cb func(*LibraryEntry) error) error {
55 zrdr := ioutil.NopCloser(rdr)
58 zrdr, err = pgzip.NewReader(bufio.NewReaderSize(rdr, 1<<20))
64 dec := gob.NewDecoder(zrdr)
67 err = dec.Decode(&ent)
70 } else if err != nil {