-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathreader.go
More file actions
53 lines (45 loc) · 2.57 KB
/
reader.go
File metadata and controls
53 lines (45 loc) · 2.57 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
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/indices"
)
type templatesAndPolicyReader struct{}
// NewTemplatesAndPolicyReader will create a new instance of templatesAndPolicyReader
func NewTemplatesAndPolicyReader() *templatesAndPolicyReader {
return new(templatesAndPolicyReader)
}
// GetElasticTemplatesAndPolicies will return templates and policies
func (tr *templatesAndPolicyReader) GetElasticTemplatesAndPolicies() (map[string]*bytes.Buffer, map[string]*bytes.Buffer, error) {
indexPolicies := make(map[string]*bytes.Buffer)
indexTemplates := make(map[string]*bytes.Buffer)
indexTemplates["opendistro"] = indices.OpenDistro.ToBuffer()
indexTemplates[indexer.TransactionsIndex] = indices.Transactions.ToBuffer()
indexTemplates[indexer.BlockIndex] = indices.Blocks.ToBuffer()
indexTemplates[indexer.MiniblocksIndex] = indices.Miniblocks.ToBuffer()
indexTemplates[indexer.RatingIndex] = indices.Rating.ToBuffer()
indexTemplates[indexer.RoundsIndex] = indices.Rounds.ToBuffer()
indexTemplates[indexer.ValidatorsIndex] = indices.Validators.ToBuffer()
indexTemplates[indexer.AccountsIndex] = indices.Accounts.ToBuffer()
indexTemplates[indexer.AccountsHistoryIndex] = indices.AccountsHistory.ToBuffer()
indexTemplates[indexer.AccountsESDTIndex] = indices.AccountsESDT.ToBuffer()
indexTemplates[indexer.AccountsESDTHistoryIndex] = indices.AccountsESDTHistory.ToBuffer()
indexTemplates[indexer.EpochInfoIndex] = indices.EpochInfo.ToBuffer()
indexTemplates[indexer.ReceiptsIndex] = indices.Receipts.ToBuffer()
indexTemplates[indexer.ScResultsIndex] = indices.SCResults.ToBuffer()
indexTemplates[indexer.SCDeploysIndex] = indices.SCDeploys.ToBuffer()
indexTemplates[indexer.TokensIndex] = indices.Tokens.ToBuffer()
indexTemplates[indexer.TagsIndex] = indices.Tags.ToBuffer()
indexTemplates[indexer.LogsIndex] = indices.Logs.ToBuffer()
indexTemplates[indexer.DelegatorsIndex] = indices.Delegators.ToBuffer()
indexTemplates[indexer.OperationsIndex] = indices.Operations.ToBuffer()
indexTemplates[indexer.ESDTsIndex] = indices.ESDTs.ToBuffer()
indexTemplates[indexer.ValuesIndex] = indices.Values.ToBuffer()
indexTemplates[indexer.EventsIndex] = indices.Events.ToBuffer()
return indexTemplates, indexPolicies, nil
}
// GetExtraMappings will return an array of indices extra mappings
func (tr *templatesAndPolicyReader) GetExtraMappings() ([]templates.ExtraMapping, error) {
return []templates.ExtraMapping{}, nil
}