Skip to content

Commit 6104a8c

Browse files
authored
Merge pull request #1452 from fwsGonzo/dev
liu: Rename begin() to exec(), update descriptions
2 parents 6dd1d71 + b761e3b commit 6104a8c

4 files changed

Lines changed: 13 additions & 15 deletions

File tree

lib/LiveUpdate/liveupdate.hpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ struct Restore;
3636
typedef std::vector<char> buffer_t;
3737

3838
/**
39-
* The beginning and the end of the LiveUpdate process is the begin() and resume() functions.
40-
* begin() is called with a provided fixed memory location for where to store all serialized data,
39+
* The beginning and the end of the LiveUpdate process is the exec() and resume() functions.
40+
* exec() is called with a provided fixed memory location for where to store all serialized data,
4141
* and after an update is_resumable, with the same fixed memory location, will return true.
4242
* resume() can then be called with this same location, and it will call handlers for each @id it finds,
4343
* unless no such handler is registered, in which case it just calls the default handler which is passed
@@ -55,10 +55,10 @@ struct LiveUpdate
5555

5656
// Start a live update process, storing all user-defined data
5757
// If no storage function is provided no state will be saved
58-
static void begin(buffer_t blob);
58+
static void exec(const buffer_t& blob);
5959

60-
// In the event that LiveUpdate::begin() fails,
61-
// call this function in the C++ exception handler:
60+
// In the event that LiveUpdate::exec() fails,
61+
// call this function in the C++ exception catch scope:
6262
static void restore_environment();
6363

6464
// Only store user data, as if there was a live update process
@@ -105,7 +105,7 @@ struct LiveUpdate
105105

106106
/**
107107
* The Storage object is passed to the user from the handler given to the
108-
* call to begin(), starting the liveupdate process. When the handler is
108+
* call to exec(), starting the liveupdate process. When the handler is
109109
* called the system is ready to serialize data into the given @location.
110110
* By using the various add_* functions, the user stores data with @uid
111111
* as a marker to be able to recognize the object when restoring data.
@@ -146,16 +146,14 @@ struct Storage
146146
};
147147

148148
/**
149-
* A Restore object is given to the user by restore handlers,
149+
* A Restore object is given to the user in a restore handler,
150150
* during the resume() process. The user should know what type
151151
* each id is, and call the correct as_* function. The object
152152
* will still be validated, and an error is thrown if there was
153-
* a type mismatch in most cases.
153+
* a type mismatch in some cases.
154154
*
155-
* It's possible to restore many objects from the same handler by
156-
* using go_next(). In that way, a user can restore complicated objects
157-
* completely without leaving the handler. go_next() will throw if there
158-
* is no next object to go to.
155+
* Use go_next() on the Restore& object to go to the next
156+
* deserializable object in the storage.
159157
*
160158
**/
161159
struct Restore

lib/LiveUpdate/rollback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void LiveUpdate::rollback_now(const char* reason)
3838
{
3939
buffer_t vec(rollback_data, rollback_data + rollback_len);
4040
// run live update process
41-
LiveUpdate::begin(std::move(vec));
41+
LiveUpdate::exec(vec);
4242
}
4343
catch (std::exception& err)
4444
{

lib/LiveUpdate/update.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ inline bool validate_header(const Class* hdr)
8484
hdr->e_ident[3] == 'F';
8585
}
8686

87-
void LiveUpdate::begin(buffer_t blob)
87+
void LiveUpdate::exec(const buffer_t& blob)
8888
{
8989
void* location = OS::liveupdate_storage_area();
9090
LPRINT("LiveUpdate::begin(%p, %p:%d, ...)\n", location, blob.data(), (int) blob.size());

lib/uplink/ws_uplink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ namespace uplink {
255255
ws_->close();
256256
// do the update
257257
Timers::oneshot(std::chrono::milliseconds(10), [this, buffer] (auto) {
258-
liu::LiveUpdate::begin(buffer);
258+
liu::LiveUpdate::exec(buffer);
259259
});
260260
}
261261

0 commit comments

Comments
 (0)