-
Notifications
You must be signed in to change notification settings - Fork 215
Enhancement: Add the ability to save and restore the state of an adaptor #33
Comments
With the changes being made in noid, it will no longer be viable to only store the id and timestamp. We'll need to store the entire Msg.Data now which will change the interface to type SessionStore interface {
Set(path string, msg *message.Msg) error
Get(path string) (*message.Msg, error)
} |
Another part of this that has yet to be discussed is how to actually configure a SessionStore. My thought is to have something like the following in the config.yaml: sessions:
type: "filestore",
interval: 10s,
uri: "file:///tmp/transporter.state" If the sessions section is missing, no SessionStore will be used. |
Made another change to the interface to use a struct instead of just the message.Msg. This will allow adaptors to store additional information while processing documents. type SessionStore interface {
Set(path string, state *MsgState) error
Get(path string) (*MsgState, error)
}
type MsgState struct {
Msg *message.Msg
Extra map[string]interface{}
} |
do we need a map[string]interface{} there? |
possibly, the purpose of the map is so adaptors could set things like Extra["progress"] = "copy" or Extra["progress"] = "tail" in the case of the MongoDB adaptor that could just as easily be solved I guess but didn't want to limit things right away |
This is the most important feature I need. I also want It to be distributed, Allow another node to restore the state if the current node is down by saving the state on a central server (or using etcd) |
+1 |
1 similar comment
+1 |
@methuz I hope to get the adaptor state branch going again very soon but the initial implementation will not involve any distributed aspect to running transporter. The initial goal is for transporter to save its running state at specified intervals to a |
Hi, Since the feature has already been merged into master, post-configuring the config.yaml, how does one go about using it in application.js? |
+1 |
1 similar comment
+1 |
Currently, if transporter fails, it is not able to start back where it left off during a copy/tail. In order to support this, each adaptor will want to save/persist the most recent document it has processed. We should be able to support multiple types of persistent stores using a simple interface like so:
The path would typically be a combination of the Transporter key and the node path. When retrieving the last known State, we will only return the last
_id
and the timestamp of the operation. It may be necessary in the future to support retuning the entire message.Msg.Ideally, an implementing class will not constantly write the last operation but have the ability to "flush" on an interval which can be defined in the config.yaml.
The beginning of this can be seen in adaptor-state branch but it is incomplete. It currently introduces a sessionTicker where the Pipeline will call the
Set
func for each Node. As of right now, I have not added the ability to retrieve/get the state during startup/initialization.Thoughts and feedback?
The text was updated successfully, but these errors were encountered: