-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
indexer binary #168
indexer binary #168
Conversation
go.mod
Outdated
github.com/ElrondNetwork/elrond-go-core v1.1.19-0.20220829095131-68a85ab9fe00 | ||
github.com/ElrondNetwork/elrond-go-logger v1.0.7 | ||
github.com/ElrondNetwork/elrond-vm-common v1.3.7 | ||
github.com/ElrondNetwork/elrond-go-core v1.1.21-0.20220927113554-34ccab6be8c3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper tags before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do after reviews and testing
url = "http://localhost:9200" | ||
username = "" | ||
password = "" | ||
bulk-request-max-size-in-bytes = 4194304 # 4MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enabled-indices and web-socket are still "prefs".. might move them as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
log.Info("closing indexer") | ||
if !check.IfNil(fileLogging) { | ||
<-interrupt | ||
wsClient.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might add a log before wsClient.Close()
closing app at user's signal
or something similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
cmd/elasticindexer/main.go
Outdated
@@ -131,5 +147,15 @@ func initializeLogger(ctx *cli.Context, cfg *config.Config) (file.FileLoggingHan | |||
return nil, err | |||
} | |||
|
|||
err = logger.RemoveLogObserver(os.Stdout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might extract the new code in a function removeANSICollorsForLogger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -68,7 +68,7 @@ func TestAccountBalanceNFTTransfer(t *testing.T) { | |||
}, | |||
} | |||
|
|||
err = esProc.SaveTransactions(body, header, pool, coreAlteredAccounts, false, 3) | |||
err = esProc.SaveTransactions(body, header, pool, coreAlteredAccounts, false, testsNumOfShards) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testsNumOfShards
-> testNumOfShards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
process/wsclient/client.go
Outdated
} | ||
|
||
func NewWebSocketClient(urlReceive string, actions map[data.OperationType]func(marshalledData []byte) error) (*client, error) { | ||
urlReceiveData := url.URL{Scheme: "ws", Host: fmt.Sprintf(urlReceive), Path: "/operations"} | ||
// New will create a new instance of web-sockets client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
websocket*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
process/wsclient/client.go
Outdated
if strings.Contains(err.Error(), closedConnection) { | ||
return true | ||
} | ||
log.Warn("websocket error, retrying in ...", "error", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
return &indexer{ | ||
marshaller: marshaller, | ||
di: dataIndexer, | ||
}, nil | ||
} | ||
|
||
func (i *indexer) GetFunctionsMap() map[data.OperationType]func(d []byte) error { | ||
func (i *indexer) GetOperationsMap() map[data.OperationType]func(d []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
process/wsindexer/interface.go
Outdated
@@ -5,11 +5,13 @@ import ( | |||
"github.com/ElrondNetwork/elrond-go-core/data/outport" | |||
) | |||
|
|||
// WSClient defines what a websockets client should do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
websocket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
cmd/elasticindexer/config/prefs.toml
Outdated
@@ -0,0 +1,16 @@ | |||
[config] | |||
enabled-indices = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as agreed, let's move back in the config this list, we will call it available-indices
and in this prefs.toml we will have the disabled-indices
cmd/elasticindexer/main.go
Outdated
return fileLogging, nil | ||
} | ||
|
||
func removeANSIColorsForLogger() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be conditioned by a flag. Why do we want to remove the colors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a flag for this.
.github/workflows/golangci-lint.yml
Outdated
on: | ||
push: | ||
branches: | ||
- master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will need to get changed to branches: [ master, development, feat/*, rc/* ]
as fixing a linter issue on a PR will not start the re-check process. Where did you get this file? So we can also apply the patch there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
package integrationtests | ||
|
||
const ( | ||
//nolint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why nolint call here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gogang-ci
linter detects that these constants are not used, which is false
|
||
const ( | ||
//nolint | ||
testNumOfShards = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for defining consts
func setLogLevelDebug() { | ||
_ = logger.SetLogLevel("process:DEBUG") | ||
} | ||
|
||
//nolint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why nolint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gogang-ci
linter detects that function is not used, which is false
case <-time.After(time.Second): | ||
} | ||
closed := c.listeningOnWebSocket() | ||
if closed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this process will immediately close if the node process closes but when it is first started, it will wait until the node process boots up. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is first started will close immediately, and it will wait on the close when writing something in the Elasticsearch database
} | ||
|
||
type argsSaveBlock struct { | ||
TransactionsPool *poolStruct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exported field in an unexported struct of an unexported type. "cessary" exported TransactionsPool param
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This structure is used to can unmarshal the received data
factory/wsIndexerFactory.go
Outdated
|
||
for _, availableIndex := range availableIndices { | ||
_, found := mapDisabledIndices[availableIndex] | ||
if !found { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename found
to shouldSkip
and refactor: if shouldSkip { continue } indices = ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
web-sockets