17 #ifndef __SLAVE_STATE_HPP__ 18 #define __SLAVE_STATE_HPP__ 57 struct ResourcesState;
58 struct FrameworkState;
83 Result<T> result = ::protobuf::read<T>(path);
107 read<google::protobuf::RepeatedPtrField<Resource>>(
path);
117 return std::move(resources.
get());
124 const std::string&
path,
125 const std::string& message,
135 typename std::enable_if<
136 std::is_convertible<T*, google::protobuf::Message*>::value,
139 const std::string&
path,
161 const std::string&
path,
162 google::protobuf::RepeatedPtrField<Resource> resources,
183 const std::string&
path,
188 const google::protobuf::RepeatedPtrField<Resource>& messages = resources;
189 return checkpoint(path, messages, sync, downgrade);
212 template <
typename T>
214 const std::string&
path,
217 bool downgrade =
true)
224 return Error(
"Failed to create directory '" + base +
"': " + mkdir.
error());
234 if (temp.isError()) {
235 return Error(
"Failed to create temporary file: " + temp.error());
241 if (checkpoint.isError()) {
245 return Error(
"Failed to write temporary file '" + temp.get() +
246 "': " + checkpoint.error());
251 if (rename.isError()) {
255 return Error(
"Failed to rename '" + temp.get() +
"' to '" +
256 path +
"': " + rename.error());
274 const std::string& rootDir,
275 const SlaveID& slaveId,
276 const FrameworkID& frameworkId,
277 const ExecutorID& executorId,
278 const ContainerID& containerId,
279 const TaskID& taskId,
295 const std::string& rootDir,
296 const SlaveID& slaveId,
297 const FrameworkID& frameworkId,
298 const ExecutorID& executorId,
299 const ContainerID& containerId,
324 const std::string& rootDir,
325 const SlaveID& slaveId,
326 const FrameworkID& frameworkId,
327 const ExecutorID& executorId,
336 bool generatedForCommandTask =
false;
345 const std::string& rootDir,
346 const SlaveID& slaveId,
347 const FrameworkID& frameworkId,
368 const std::string& rootDir,
382 const std::string& rootDir,
383 const SlaveID& slaveId,
410 bool rebooted =
false;
423 #endif // __SLAVE_STATE_HPP__ FrameworkState()
Definition: state.hpp:342
unsigned int errors
Definition: state.hpp:315
Try< Nothing > downgradeResources(google::protobuf::RepeatedPtrField< Resource > *resources)
Try< Nothing > checkpoint(const std::string &path, const std::string &message, bool sync, bool downgradeResources)
Definition: state.hpp:123
bool isNone() const
Definition: result.hpp:113
hashmap< FrameworkID, FrameworkState > frameworks
Definition: state.hpp:389
Definition: nothing.hpp:16
Definition: errorbase.hpp:36
Option< DrainConfig > drainConfig
Definition: state.hpp:396
Try< Nothing > rm(const std::string &path)
Definition: rm.hpp:26
Option< ResourcesState > resources
Definition: state.hpp:408
Definition: state.hpp:319
Option< process::UPID > libprocessPid
Definition: state.hpp:306
static Result< T > error(const std::string &message)
Definition: result.hpp:54
unsigned int errors
Definition: state.hpp:373
Option< FrameworkInfo > info
Definition: state.hpp:352
Option< Resources > target
Definition: state.hpp:372
hashmap< TaskID, TaskState > tasks
Definition: state.hpp:304
Try< std::string > mktemp(const std::string &path=path::join(os::temp(),"XXXXXX"))
Definition: mktemp.hpp:36
Result< Resources > read< Resources >(const std::string &path)
Definition: state.hpp:104
Option< ContainerID > id
Definition: state.hpp:303
unsigned int errors
Definition: state.hpp:286
Definition: state.hpp:377
Definition: resources.hpp:83
hashset< id::UUID > acks
Definition: state.hpp:285
Option< std::vector< Operation > > operations
Definition: state.hpp:393
std::vector< StatusUpdate > updates
Definition: state.hpp:284
std::string join(const std::string &path1, const std::string &path2, const char _separator=os::PATH_SEPARATOR)
Definition: path.hpp:116
Option< ContainerID > latest
Definition: state.hpp:333
Definition: state.hpp:363
Option< bool > http
Definition: state.hpp:310
void upgradeResources(google::protobuf::RepeatedPtrField< Resource > *resources)
Definition: hashmap.hpp:38
Try< Nothing > mkdir(const std::string &directory, bool recursive=true, bool sync=false)
Definition: mkdir.hpp:42
ExecutorID id
Definition: state.hpp:331
Resources resources
Definition: state.hpp:371
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:212
Definition: state.hpp:269
RunState()
Definition: state.hpp:292
Definition: state.hpp:290
hashmap< ContainerID, RunState > runs
Definition: state.hpp:334
ExecutorState()
Definition: state.hpp:321
Option< pid_t > forkedPid
Definition: state.hpp:305
Option< ExecutorInfo > info
Definition: state.hpp:332
unsigned int errors
Definition: state.hpp:415
State()
Definition: state.hpp:406
static Try error(const E &e)
Definition: try.hpp:43
Try< State > recover(const std::string &rootDir, bool strict)
unsigned int errors
Definition: state.hpp:359
Option< Task > info
Definition: state.hpp:283
std::string dirname() const
Extracts the component up to, but not including, the final '/'.
Definition: path.hpp:308
FrameworkID id
Definition: state.hpp:351
Result< T > read(const std::string &path)
Definition: state.hpp:81
Try< Nothing > rename(const std::string &from, const std::string &to, bool sync=false)
Definition: rename.hpp:40
Result< std::string > read(int_fd fd, size_t size)
Definition: read.hpp:55
Definition: attributes.hpp:24
bool isError() const
Definition: try.hpp:78
T & get()&
Definition: result.hpp:116
ResourcesState()
Definition: state.hpp:365
TaskState()
Definition: state.hpp:271
SlaveID id
Definition: state.hpp:387
Protocol< WriteRequest, WriteResponse > write
unsigned int errors
Definition: state.hpp:398
Try< uint32_t > type(const std::string &path)
std::string temp()
Definition: temp.hpp:27
bool isSome() const
Definition: result.hpp:112
bool isError() const
Definition: result.hpp:114
Option< SlaveState > slave
Definition: state.hpp:409
unsigned int errors
Definition: state.hpp:335
SlaveState()
Definition: state.hpp:379
bool completed
Definition: state.hpp:313
Option< process::UPID > pid
Definition: state.hpp:356
Option< SlaveInfo > info
Definition: state.hpp:388
TaskID id
Definition: state.hpp:282
hashmap< ExecutorID, ExecutorState > executors
Definition: state.hpp:358
Definition: state.hpp:404
Definition: state.hpp:340