Use native client to read annotations.csv.
[lightning.git] / taglib.go
index 3dc45b80c08d67772cd4d6930fecf052bc44fce9..7ccce151871f7b4f178e3727d4acfe09ef5b1ab2 100644 (file)
--- a/taglib.go
+++ b/taglib.go
@@ -1,4 +1,8 @@
-package main
+// Copyright (C) The Lightning Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package lightning
 
 import (
        "bufio"
@@ -69,6 +73,10 @@ func (taglib *tagLibrary) Len() int {
        return len(taglib.tagmap)
 }
 
+func (taglib *tagLibrary) TagLen() int {
+       return taglib.keylen
+}
+
 var (
        twobit = func() []tagmapKey {
                r := make([]tagmapKey, 256)
@@ -117,3 +125,17 @@ func (taglib *tagLibrary) setTags(tags [][]byte) error {
        }
        return nil
 }
+
+func (taglib *tagLibrary) Tags() [][]byte {
+       out := make([][]byte, len(taglib.tagmap))
+       untwobit := []byte{'a', 'c', 'g', 't'}
+       for key, info := range taglib.tagmap {
+               seq := make([]byte, taglib.keylen)
+               for i := len(seq) - 1; i >= 0; i-- {
+                       seq[i] = untwobit[int(key)&3]
+                       key = key >> 2
+               }
+               out[int(info.id)] = seq
+       }
+       return out
+}