mirror of https://github.com/status-im/go-waku.git
feat(library): add storeQuery and isStarted functions (#272)
This commit is contained in:
parent
069d66ed6d
commit
f5936783c0
|
@ -48,6 +48,13 @@ func waku_stop() *C.char {
|
||||||
return C.CString(response)
|
return C.CString(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//export waku_is_started
|
||||||
|
// Determine is a node is started or not
|
||||||
|
func waku_is_started() *C.char {
|
||||||
|
response := mobile.IsStarted()
|
||||||
|
return C.CString(response)
|
||||||
|
}
|
||||||
|
|
||||||
//export waku_peerid
|
//export waku_peerid
|
||||||
// Obtain the peer ID of the waku node
|
// Obtain the peer ID of the waku node
|
||||||
func waku_peerid() *C.char {
|
func waku_peerid() *C.char {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// "startTime": 1234, // optional, unix epoch time in nanoseconds
|
// "startTime": 1234, // optional, unix epoch time in nanoseconds
|
||||||
// "endTime": 1234, // optional, unix epoch time in nanoseconds
|
// "endTime": 1234, // optional, unix epoch time in nanoseconds
|
||||||
// "contentFilters": [ // optional
|
// "contentFilters": [ // optional
|
||||||
// "contentTopic1", "contentTopic2" ...
|
// "contentTopic1", ...
|
||||||
// ],
|
// ],
|
||||||
// "pagingOptions": {// optional pagination information
|
// "pagingOptions": {// optional pagination information
|
||||||
// "pageSize": 40, // number
|
// "pageSize": 40, // number
|
||||||
|
|
|
@ -25,6 +25,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var wakuNode *node.WakuNode
|
var wakuNode *node.WakuNode
|
||||||
|
var wakuStarted = false
|
||||||
|
|
||||||
var errWakuNodeNotReady = errors.New("go-waku not initialized")
|
var errWakuNodeNotReady = errors.New("go-waku not initialized")
|
||||||
|
|
||||||
|
@ -151,6 +152,8 @@ func Start() string {
|
||||||
return makeJSONResponse(err)
|
return makeJSONResponse(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wakuStarted = true
|
||||||
|
|
||||||
return makeJSONResponse(nil)
|
return makeJSONResponse(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,11 +163,17 @@ func Stop() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
wakuNode.Stop()
|
wakuNode.Stop()
|
||||||
|
|
||||||
|
wakuStarted = false
|
||||||
wakuNode = nil
|
wakuNode = nil
|
||||||
|
|
||||||
return makeJSONResponse(nil)
|
return makeJSONResponse(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsStarted() string {
|
||||||
|
return prepareJSONResponse(wakuStarted, nil)
|
||||||
|
}
|
||||||
|
|
||||||
func PeerID() string {
|
func PeerID() string {
|
||||||
if wakuNode == nil {
|
if wakuNode == nil {
|
||||||
return makeJSONResponse(errWakuNodeNotReady)
|
return makeJSONResponse(errWakuNodeNotReady)
|
||||||
|
|
Loading…
Reference in New Issue