| 304 | |
| 305 | |
| 306 | Future<Option<uint64_t>> CoordinatorProcess::append(const string& bytes) |
| 307 | { |
| 308 | if (state == INITIAL || state == ELECTING) { |
| 309 | return None(); |
| 310 | } else if (state == WRITING) { |
| 311 | return Failure("Coordinator is currently writing"); |
| 312 | } |
| 313 | |
| 314 | Action action; |
| 315 | action.set_position(index); |
| 316 | action.set_promised(proposal); |
| 317 | action.set_performed(proposal); |
| 318 | action.set_type(Action::APPEND); |
| 319 | Action::Append* append = action.mutable_append(); |
| 320 | append->set_bytes(bytes); |
| 321 | |
| 322 | return write(action); |
| 323 | } |
| 324 | |
| 325 | |
| 326 | Future<Option<uint64_t>> CoordinatorProcess::truncate(uint64_t to) |