gnomes

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 28 Imported by: 12

Documentation

Index

Constants

View Source
const (
	NFA_SEARCH_FILTER = `` /* 977-byte string literal not displayed */

	G45_search_filter = `STORE("type", "G45-NFT")`
)

Variables

View Source
var Indicator indicator

Gnomon GUI indicator

Functions

func AddToIndex

func AddToIndex(scids []string) (err error)

Manually add SCID(s) to Gnomon index

func CheckOwner

func CheckOwner(scid string) bool

Check owner of any SCID using "owner" key

func DeleteStorage

func DeleteStorage(bucket, key string)

Delete data from boltdb

func EndPoint

func EndPoint()

Update Gnomon endpoint to current rpc.Daemon.Rpc value

func GetAssetUrl

func GetAssetUrl(w int, scid string) (url string)

Get a requested NFA url

  • w of 0 returns "fileURL"
  • w of 1 returns "iconURLHdr"
  • w of 2 returns "coverURLHdr"

func GetStorage

func GetStorage(bucket, key string, out interface{})

Get data from boltdb

func InitLogrusLog

func InitLogrusLog(level logrus.Level)

Initialize logrus logger matching Gnomon log

func IsConnected

func IsConnected() bool

Check if Gnomon and RPC are ready

func NewBoltDB

func NewBoltDB(dbType, dbPath string) *storage.BboltStore

Create a new bbolt DB with dReams tag for Gnomon storage

  • If dbType is not boltdb, will return nil boltdb

func NewGravDB

func NewGravDB(dbType, dbPath string) *storage.GravitonStore

Create a new graviton DB for Gnomon storage

  • If dbType is boltdb, will return nil gravdb

func Scan

func Scan(config bool) bool

Scan tells dApps if Gnomon is ready for them to preform their initial scan

func StartGnomon

func StartGnomon(tag, dbtype string, filters []string, upper, lower int, custom func())

Start Gnomon indexer with or without search filters

  • End point from rpc.Daemon.Rpc
  • tag for log print
  • dbtype defines gravdb or boltdb
  • custom func() is for adding specific SCID to index on Gnomon start, gnomes.Fast.Enabled false will bypass
  • lower defines the lower limit of indexed SCIDs from Gnomon search filters before custom adds
  • upper defines the higher limit when custom indexed SCIDs exist already

func State

func State(config bool, scan func(map[string]string))

State checks and maintains Gnomon state (synced/scanning/checked), it will scan connected wallet once synced, then ensure sync

  • Hold out checking if app is configuring
  • Pass scan func for initial Gnomon sync

func StorageExists

func StorageExists(bucket, key string) (found bool, err error)

Check if data exists in boltdb

func StoreBolt

func StoreBolt(bucket, key string, store interface{}) (err error)

Store data in boltdb, if using gravdb it will not store index

func ToolTip

func ToolTip(offset float32, can fyne.Canvas) *toolTip

Display Gnomon heights when hovered

Types

type Gnomes

type Gnomes interface {
	Status() string
	IsStatus(status string) bool
	IsStarting() bool
	DBStorageType() string
	SetDBStorageType(s string)
	GetLastHeight() int64
	GetChainHeight() int64
	Stop(tag string)
	IsWriting() bool
	Writing(b bool)
	IsClosing() bool
	Initialized(b bool)
	IsInitialized() bool
	Scanning(b bool)
	IsScanning() bool
	Checked(b bool)
	HasChecked() bool
	IndexContains() map[string]string
	IndexCount() uint64
	ZeroIndexCount()
	HasIndex(u uint64) bool
	Synced(b bool)
	IsSynced() bool
	IsRunning() bool
	IsReady() bool
	SetFastsync(enabled, force bool, diff int64)
	GetFastsync() structures.FastSyncConfig
	SetParallel(i int)
	GetParallel() int
	SetSearchFilters(filters []string)
	GetSearchFilters() []string
	GetAllOwnersAndSCIDs() map[string]string
	GetSCIDValuesByKey(scid string, key interface{}) (valuesstring []string, valuesuint64 []uint64)
	GetSCIDKeysByValue(scid string, key interface{}) (valuesstring []string, valuesuint64 []uint64)
	GetAllSCIDVariableDetails(scid string) []*structures.SCIDVariable
	AddSCIDToIndex(scids map[string]*structures.FastSyncImport) error
	GetLiveSCIDValuesByKey(scid string, key interface{}) (valuesstring []string, valuesuint64 []uint64, err error)
	ControlPanel(w fyne.Window) *fyne.Container
}

Gnomes exposes methods of Gnomon

func NewGnomes

func NewGnomes() Gnomes

Create new instance of gnomes

type Gnomon

type Gnomon struct {
	DBType  string
	Para    int
	Fast    structures.FastSyncConfig
	Start   bool
	Init    bool
	Sync    bool
	Syncing bool
	Check   bool
	SCIDS   uint64
	Indexer *indexer.Indexer
	sync.RWMutex
}

Gnomon contains params and Indexer for running Gnomon package

func (*Gnomon) AddSCIDToIndex

func (g *Gnomon) AddSCIDToIndex(scids map[string]*structures.FastSyncImport) error

Method of Gnomon Indexer.AddSCIDToIndex()

func (*Gnomon) Checked

func (g *Gnomon) Checked(b bool)

Set Gnomes.Checked var

func (*Gnomon) ControlPanel

func (g *Gnomon) ControlPanel(w fyne.Window) *fyne.Container

UI control panel to set Gnomon vars

func (*Gnomon) DBStorageType

func (g *Gnomon) DBStorageType() string

Get DBType

func (*Gnomon) GetAllOwnersAndSCIDs

func (g *Gnomon) GetAllOwnersAndSCIDs() map[string]string

Method of Gnomon GetAllOwnersAndSCIDs() where DB type is defined by Indexer.DBType

  • Default is boltdb

func (*Gnomon) GetAllSCIDVariableDetails

func (g *Gnomon) GetAllSCIDVariableDetails(scid string) []*structures.SCIDVariable

Method of Gnomon GetAllSCIDVariableDetails() where DB type is defined by Indexer.DBType

  • Default is boltdb

func (*Gnomon) GetChainHeight

func (g *Gnomon) GetChainHeight() (height int64)

Get Indexer.ChainHeight

func (*Gnomon) GetFastsync

func (g *Gnomon) GetFastsync() structures.FastSyncConfig

Get Gnomon structures.FastSyncConfig

func (*Gnomon) GetLastHeight

func (g *Gnomon) GetLastHeight() (height int64)

Get Indexer.LastIndexedHeight

func (*Gnomon) GetLiveSCIDValuesByKey

func (g *Gnomon) GetLiveSCIDValuesByKey(scid string, key interface{}) (valuesstring []string, valuesuint64 []uint64, err error)

Method of Gnomon Indexer.GetSCIDValuesByKey()

func (*Gnomon) GetParallel

func (g *Gnomon) GetParallel() int

Get Indexer parallel blocks value

func (*Gnomon) GetSCIDKeysByValue

func (g *Gnomon) GetSCIDKeysByValue(scid string, key interface{}) (valuesstring []string, valuesuint64 []uint64)

Method of Gnomon GetSCIDKeysByValue() where DB type is defined by Indexer.DBType

  • Default is boltdb

func (*Gnomon) GetSCIDValuesByKey

func (g *Gnomon) GetSCIDValuesByKey(scid string, key interface{}) (valuesstring []string, valuesuint64 []uint64)

Method of Gnomon GetSCIDValuesByKey() where DB type is defined by Indexer.DBType

  • Default is boltdb

func (*Gnomon) GetSearchFilters

func (g *Gnomon) GetSearchFilters() []string

Get Indexer search filters

func (*Gnomon) HasChecked

func (g *Gnomon) HasChecked() bool

Check if Gnomes.Checked

func (*Gnomon) HasIndex

func (g *Gnomon) HasIndex(u uint64) bool

Check if Gnomes index contains SCIDs >= u

func (*Gnomon) IndexContains

func (g *Gnomon) IndexContains() map[string]string

Set Gnomes.SCIDS index count and return GetAllOwnersAndSCIDs()

func (*Gnomon) IndexCount

func (g *Gnomon) IndexCount() uint64

Returns Gnomes.SCIDS

func (*Gnomon) Initialized

func (g *Gnomon) Initialized(b bool)

Set Gnomes.Init var

func (*Gnomon) IsClosing

func (g *Gnomon) IsClosing() bool

Check if Gnomon is closing

func (*Gnomon) IsInitialized

func (g *Gnomon) IsInitialized() bool

Check if Gnomes.Init

func (*Gnomon) IsReady

func (g *Gnomon) IsReady() bool

Check if Gnomon is initialized, synced and not closing

func (*Gnomon) IsRunning

func (g *Gnomon) IsRunning() bool

Check if Gnomon is initialized, and not closing

func (*Gnomon) IsScanning

func (g *Gnomon) IsScanning() bool

Check if Gnomes.Syncing

func (*Gnomon) IsStarting

func (g *Gnomon) IsStarting() bool

Returns true if gnomes is starting

func (*Gnomon) IsStatus

func (g *Gnomon) IsStatus(status string) bool

Returns if Indexer.Status matches status string

func (*Gnomon) IsSynced

func (g *Gnomon) IsSynced() bool

Check if Gnomes.Sync

func (*Gnomon) IsWriting

func (g *Gnomon) IsWriting() bool

Check if Indexer is writing

func (*Gnomon) Scanning

func (g *Gnomon) Scanning(b bool)

Set Gnomes.Syncing var when scanning wallet

func (*Gnomon) SetDBStorageType

func (g *Gnomon) SetDBStorageType(s string)

Set DB type to be used

  • boltdb
  • gravdb

func (*Gnomon) SetFastsync

func (g *Gnomon) SetFastsync(enabled, force bool, diff int64)

Set Gnomon structures.FastSyncConfig, skip recheck and no code default false

func (*Gnomon) SetParallel

func (g *Gnomon) SetParallel(i int)

Set Indexer parallel blocks value

func (*Gnomon) SetSearchFilters

func (g *Gnomon) SetSearchFilters(filters []string)

Set Indexer search filters

func (*Gnomon) Status

func (g *Gnomon) Status() (status string)

Returns Status string from Indexer

func (*Gnomon) Stop

func (g *Gnomon) Stop(tag string)

Shut down gnomes.Indexer

  • tag for log print

func (*Gnomon) Synced

func (g *Gnomon) Synced(b bool)

Set Gnomes.Sync var

func (*Gnomon) Writing

func (g *Gnomon) Writing(b bool)

Set Indexer.Backend.Writing var, if set true will wait if Indexer is writing already

func (*Gnomon) ZeroIndexCount

func (g *Gnomon) ZeroIndexCount()

Set index count to zero

type SC

type SC struct {
	ID      string
	Rating  uint64
	Version uint64
	Header  SCHeaders
}

SCID with Gnomon headers

type SCHeaders

type SCHeaders struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	IconURL     string `json:"iconURL"`
}

Headers from Gnomon SC

func GetSCHeaders

func GetSCHeaders(scid string) (header SCHeaders)

Get Gnomon headers of SCID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL