2023-08-10 13:30:38 +00:00
|
|
|
package gowaku
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/waku-org/go-waku/library"
|
|
|
|
)
|
|
|
|
|
|
|
|
// StoreQuery is used to retrieve historic messages using waku store protocol.
|
2023-12-15 14:46:21 +00:00
|
|
|
func StoreQuery(instanceID uint, queryJSON string, peerID string, ms int) string {
|
|
|
|
instance, err := library.GetInstance(instanceID)
|
|
|
|
if err != nil {
|
|
|
|
return makeJSONResponse(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
response, err := library.StoreQuery(instance, queryJSON, peerID, ms)
|
2023-08-10 13:30:38 +00:00
|
|
|
return prepareJSONResponse(response, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// StoreLocalQuery is used to retrieve historic messages stored in the localDB using waku store protocol.
|
2023-12-15 14:46:21 +00:00
|
|
|
func StoreLocalQuery(instanceID uint, queryJSON string) string {
|
|
|
|
instance, err := library.GetInstance(instanceID)
|
|
|
|
if err != nil {
|
|
|
|
return makeJSONResponse(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
response, err := library.StoreLocalQuery(instance, queryJSON)
|
2023-08-10 13:30:38 +00:00
|
|
|
return prepareJSONResponse(response, err)
|
|
|
|
}
|