-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathwithKibana.go
More file actions
77 lines (64 loc) · 3.89 KB
/
withKibana.go
File metadata and controls
77 lines (64 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package templatesAndPolicies
import (
"bytes"
indexer "github.com/multiversx/mx-chain-es-indexer-go/process/dataindexer"
"github.com/multiversx/mx-chain-es-indexer-go/templates"
"github.com/multiversx/mx-chain-es-indexer-go/templates/withKibana"
)
type templatesAndPolicyReaderWithKibana struct{}
// NewTemplatesAndPolicyReaderWithKibana will create a new instance of templatesAndPolicyReaderWithKibana
func NewTemplatesAndPolicyReaderWithKibana() *templatesAndPolicyReaderWithKibana {
return new(templatesAndPolicyReaderWithKibana)
}
// GetElasticTemplatesAndPolicies will return templates and policies
func (tr *templatesAndPolicyReaderWithKibana) GetElasticTemplatesAndPolicies() (map[string]*bytes.Buffer, map[string]*bytes.Buffer, error) {
indexTemplates := getTemplatesKibana()
indexPolicies := getPolicies()
return indexTemplates, indexPolicies, nil
}
// GetExtraMappings will return an array of indices extra mappings
func (tr *templatesAndPolicyReaderWithKibana) GetExtraMappings() ([]templates.ExtraMapping, error) {
return []templates.ExtraMapping{}, nil
}
func getTemplatesKibana() map[string]*bytes.Buffer {
indexTemplates := make(map[string]*bytes.Buffer)
indexTemplates["opendistro"] = withKibana.OpenDistro.ToBuffer()
indexTemplates[indexer.TransactionsIndex] = withKibana.Transactions.ToBuffer()
indexTemplates[indexer.BlockIndex] = withKibana.Blocks.ToBuffer()
indexTemplates[indexer.MiniblocksIndex] = withKibana.Miniblocks.ToBuffer()
indexTemplates[indexer.RatingIndex] = withKibana.Rating.ToBuffer()
indexTemplates[indexer.RoundsIndex] = withKibana.Rounds.ToBuffer()
indexTemplates[indexer.ValidatorsIndex] = withKibana.Validators.ToBuffer()
indexTemplates[indexer.AccountsIndex] = withKibana.Accounts.ToBuffer()
indexTemplates[indexer.AccountsHistoryIndex] = withKibana.AccountsHistory.ToBuffer()
indexTemplates[indexer.AccountsESDTIndex] = withKibana.AccountsESDT.ToBuffer()
indexTemplates[indexer.AccountsESDTHistoryIndex] = withKibana.AccountsESDTHistory.ToBuffer()
indexTemplates[indexer.EpochInfoIndex] = withKibana.EpochInfo.ToBuffer()
indexTemplates[indexer.ReceiptsIndex] = withKibana.Receipts.ToBuffer()
indexTemplates[indexer.ScResultsIndex] = withKibana.SCResults.ToBuffer()
indexTemplates[indexer.SCDeploysIndex] = withKibana.SCDeploys.ToBuffer()
indexTemplates[indexer.TokensIndex] = withKibana.Tokens.ToBuffer()
indexTemplates[indexer.TagsIndex] = withKibana.Tags.ToBuffer()
indexTemplates[indexer.LogsIndex] = withKibana.Logs.ToBuffer()
indexTemplates[indexer.DelegatorsIndex] = withKibana.Delegators.ToBuffer()
indexTemplates[indexer.OperationsIndex] = withKibana.Operations.ToBuffer()
indexTemplates[indexer.ESDTsIndex] = withKibana.ESDTs.ToBuffer()
return indexTemplates
}
func getPolicies() map[string]*bytes.Buffer {
indexesPolicies := make(map[string]*bytes.Buffer)
indexesPolicies[indexer.TransactionsPolicy] = withKibana.TransactionsPolicy.ToBuffer()
indexesPolicies[indexer.BlockPolicy] = withKibana.BlocksPolicy.ToBuffer()
indexesPolicies[indexer.MiniblocksPolicy] = withKibana.MiniblocksPolicy.ToBuffer()
indexesPolicies[indexer.RatingPolicy] = withKibana.RatingPolicy.ToBuffer()
indexesPolicies[indexer.RoundsPolicy] = withKibana.RoundsPolicy.ToBuffer()
indexesPolicies[indexer.ValidatorsPolicy] = withKibana.ValidatorsPolicy.ToBuffer()
indexesPolicies[indexer.AccountsHistoryPolicy] = withKibana.AccountsHistoryPolicy.ToBuffer()
indexesPolicies[indexer.AccountsPolicy] = withKibana.AccountsPolicy.ToBuffer()
indexesPolicies[indexer.AccountsESDTPolicy] = withKibana.AccountsESDTPolicy.ToBuffer()
indexesPolicies[indexer.AccountsESDTHistoryPolicy] = withKibana.AccountsESDTHistoryPolicy.ToBuffer()
indexesPolicies[indexer.AccountsHistoryPolicy] = withKibana.AccountsHistoryPolicy.ToBuffer()
indexesPolicies[indexer.ReceiptsPolicy] = withKibana.ReceiptsPolicy.ToBuffer()
indexesPolicies[indexer.ScResultsPolicy] = withKibana.ScResultsPolicy.ToBuffer()
return indexesPolicies
}