controlPanel

package
v0.0.0-...-303b437 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 28 Imported by: 0

README

Compiling the Static files into the binary.

  • go get github.com/DCNT-developer/staticfiles
  • Run controlPanel/compile.sh from within controlPanel directory
  • 'files/statics/statics.go' and 'files/templates/templates.go' are generated and should not be manually edited.

Making Changes

  • Changes to javascript can me made in 'Web/uncompressedStatics'

  • When done, minify the js and replace the files located in 'Web/statics', then compile using 'compile.sh'

  • After all changes, compile.sh must be run

Notes:

  • If you add a third directory into the Web folder, custom management must be added in '/controlPanel/files/general.go' and 'compile.sh' must be adjusted.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UpdateTimeValue int = 5 // in seconds. How long to update the state and recent transactions

	DisplayState state.DisplayState
	StatePointer *state.State
	Controller   *p2p.Controller // Used for Disconnect

	LastRequest     time.Time
	TimeRequestHold float64 = 3 // Amount of time in seconds before can request data again

	DisplayStateChannel chan state.DisplayState

	// Sync Mutex
	TemplateMutex     sync.Mutex
	DisplayStateMutex sync.RWMutex
)
View Source
var DoingRecentTransactions bool

Flag to tell if RecentTransactions is already being built

View Source
var RecentTransactionsMutex sync.Mutex

Functions

func AllConnectionsString

func AllConnectionsString() string

func DisplayStateDrain

func DisplayStateDrain(channel chan state.DisplayState)

func FactoshiToFactoid

func FactoshiToFactoid(i uint64) string

FactoshiToFactoid converts a uint64 factoshi ammount into a fixed point number represented as a string

func FormatDuration

func FormatDuration(initial time.Time) string

func GetDataDumps

func GetDataDumps() []byte

func HandleSearchResult

func HandleSearchResult(content *SearchedStruct, w http.ResponseWriter)

func HeightToJsonStruct

func HeightToJsonStruct(height uint32) []byte

Used to send a height as json struct

func InitTemplates

func InitTemplates()

func RequestData

func RequestData()

func ServeControlPanel

func ServeControlPanel(displayStateChannel chan state.DisplayState, statePointer *state.State, connections chan interface{}, controller *p2p.Controller, gitBuild string, nodeName string)

Main function. This intiates appropriate variables and starts the control panel serving

func SetRequestMutex

func SetRequestMutex(set bool)

func SortedConnectionString

func SortedConnectionString() string

Types

type ABDisplayHolder

type ABDisplayHolder struct {
	Type      string
	OtherInfo string
}

type AblockHolder

type AblockHolder struct {
	Header struct {
		PrevBackRefHash     string `json:"prevbackrefhash"`
		DBHeight            int    `json:"dbheight"`
		HeaderExpansionSize int    `json:"headerexpansionsize"`
		HeaderExpansionArea string `json:"headerexpansionarea"`
		MessageCount        int    `json:"messagecount"`
		BodySize            int    `json:"bodysize"`
		AdminChainID        string `json:"adminchainid"`
		ChainID             string `json:"chainid"`
	} `json:"header"`
	JsonABEntries     []interface{} `json:"abentries"`
	BackReferenceHash string        `json:"backreferencehash"`
	LookupHash        string        `json:"lookuphash"`

	ABEntries []interfaces.IABEntry
	ABDisplay []ABDisplayHolder
}

type AllConnectionsTotals

type AllConnectionsTotals struct {
	PeerQualityAvg     int32
	BytesSentTotal     uint32
	BytesReceivedTotal uint32
	MessagesSent       uint32
	MessagesReceived   uint32
}

func NewAllConnectionTotals

func NewAllConnectionTotals() *AllConnectionsTotals

type ConnectionInfo

type ConnectionInfo struct {
	Connected               bool
	Hash                    string // Hash of PeerHash (Peerhash contains illegal characters for html ID)
	Connection              p2p.ConnectionMetrics
	ConnectionTimeFormatted string
	PeerHash                string
}

type ConnectionInfoArray

type ConnectionInfoArray []ConnectionInfo

func (ConnectionInfoArray) Len

func (slice ConnectionInfoArray) Len() int

func (ConnectionInfoArray) Less

func (slice ConnectionInfoArray) Less(i, j int) bool

func (ConnectionInfoArray) Swap

func (slice ConnectionInfoArray) Swap(i, j int)

type ConnectionsMap

type ConnectionsMap struct {
	Totals AllConnectionsTotals
	Lock   sync.Mutex
	// contains filtered or unexported fields
}
var AllConnections *ConnectionsMap

func NewConnectionsMap

func NewConnectionsMap() *ConnectionsMap

func (*ConnectionsMap) AddConnection

func (cm *ConnectionsMap) AddConnection(key string, val p2p.ConnectionMetrics)

func (*ConnectionsMap) CleanDisconnected

func (cm *ConnectionsMap) CleanDisconnected() int

func (*ConnectionsMap) Connect

func (cm *ConnectionsMap) Connect(key string, val *p2p.ConnectionMetrics) bool

func (*ConnectionsMap) Disconnect

func (cm *ConnectionsMap) Disconnect(key string, val *p2p.ConnectionMetrics) bool

func (*ConnectionsMap) GetConnectedCopy

func (cm *ConnectionsMap) GetConnectedCopy() map[string]p2p.ConnectionMetrics

func (*ConnectionsMap) GetConnection

func (cm *ConnectionsMap) GetConnection(key string) *p2p.ConnectionMetrics

func (*ConnectionsMap) GetDisconnectedCopy

func (cm *ConnectionsMap) GetDisconnectedCopy() map[string]p2p.ConnectionMetrics

func (*ConnectionsMap) RemoveConnection

func (cm *ConnectionsMap) RemoveConnection(key string)

func (*ConnectionsMap) SortedConnections

func (cm *ConnectionsMap) SortedConnections() ConnectionInfoArray

Used to send to front ent

func (*ConnectionsMap) TallyTotals

func (cm *ConnectionsMap) TallyTotals()

func (*ConnectionsMap) UpdateConnections

func (cm *ConnectionsMap) UpdateConnections(connections map[string]p2p.ConnectionMetrics)

type DataDump

type DataDump struct {
	DataDump1 struct {
		ShortDump   string
		RawDump     string
		SyncingDump string
	}
	DataDump2 struct {
		NextDump string
		RawDump  string
		PrevDump string
	}
	DataDump3 struct {
		RawDump string
	}
	DataDump4 struct {
		Authorities string
		Identities  string
		MyNode      string
	}
	DataDump5 struct {
		RawDump    string
		SortedDump string
	}
	ElectionDataDump struct {
		Elections         string
		SimulatedElection string
	}
	LogSettingsDump struct {
		CurrentLogSettings string
	}
}

type DblockHolder

type DblockHolder struct {
	Header struct {
		Version      int    `json:"version"`
		NetworkID    int    `json:"networkid"`
		BodyMR       string `json:"bodymr"`
		PrevKeyMR    string `json:"prevkeymr"`
		PrevFullHash string `json:"prevfullhash"`
		Timestamp    uint32 `json:"timestamp"`
		DBHeight     int    `json:"dbheight"`
		BlockCount   int    `json:"blockcount"`
		ChainID      string `json:"chainid"`

		FormatedTimeStamp string
	} `json:"header"`
	DBEntries []struct {
		ChainID string `json:"chainid"`
		KeyMR   string `json:"keymr"`
	} `json:"dbentries"`
	JsonDBHash interface{} `json:"dbhash"`
	JsonKeyMR  interface{} `json:"keymr"`

	EBlocks    []EblockHolder
	AdminBlock struct {
		ChainID string
		KeyMr   string
	}
	FactoidBlock struct {
		ChainID string
		KeyMr   string
	}
	EntryCreditBlock struct {
		ChainID string
		KeyMr   string
	}
	FullHash string
	KeyMR    string
}

type ECBlockHolder

type ECBlockHolder struct {
	ECBlock interfaces.IEntryCreditBlock
	Length  int
}

type EblockHolder

type EblockHolder struct {
	Header struct {
		ChainID      string `json:"chainid"`
		BodyMR       string `json:"bodymr"`
		PrevKeyMR    string `json:"prevkeymr"`
		PrevFullHash string `json:"prevfullhash"`
		EBSequence   int    `json:"ebsequence"`
		DBHeight     int    `json:"dbheight"`
		EntryCount   int    `json:"entrycount"`
	} `json:"header"`
	Body struct {
		EBEntries []string `json:"ebentries"`
	} `json:"body"`

	KeyMR    string
	BodyMR   string
	FullHash string
	Entries  []EntryHolder
}

type EntryHolder

type EntryHolder struct {
	ChainID string   `json:"chainid"`
	Content string   `json:"content"`
	ExtIDs  []string `json:"extids"`
	Version int      `json:"version"`

	Height        string
	Hash          string
	ContentLength int
	ContentHash   string
	ECCost        string

	Time string
}

type FBlockHolder

type FBlockHolder struct {
	factoid.FBlock
	Length int
}

type FactoidAck

type FactoidAck struct {
	ID      int    `json:"id"`
	Jsonrpc string `json:"jsonrpc"`
	Result  struct {
		Status                string  `json:"status"`
		TransactionDate       float64 `json:"transactiondate"`
		TransactionDateString string  `json:"transactiondatestring"`
		Txid                  string  `json:"txid"`
	} `json:"result"`
}

type IndexTemplateData

type IndexTemplateData struct {
	GitBuild string
	Version  string
	NodeName string
}

type LastDirectoryBlockTransactions

type LastDirectoryBlockTransactions struct {
	DirectoryBlock struct {
		KeyMR     string
		BodyKeyMR string
		FullHash  string
		DBHeight  string
		Timestamp string

		PrevFullHash string
		PrevKeyMR    string
	}
	FactoidTransactions []struct {
		TxID         string
		Hash         string
		TotalInput   string
		Status       string
		TotalInputs  int
		TotalOutputs int
	}
	Entries []EntryHolder

	LastHeightChecked uint32
}
var RecentTransactions *LastDirectoryBlockTransactions

func (*LastDirectoryBlockTransactions) ContainsEntry

func (d *LastDirectoryBlockTransactions) ContainsEntry(hash string) bool

func (*LastDirectoryBlockTransactions) ContainsTrans

func (d *LastDirectoryBlockTransactions) ContainsTrans(txid string) bool

type SearchedStruct

type SearchedStruct struct {
	Type    string      `json:"type"`
	Content interface{} `json:"item"`

	Input string `json:"input"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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