mirror of https://github.com/milvus-io/milvus.git
MS-375 Add Dump implementation for Event
Former-commit-id: c8518b48914da67bce45660866970c8c4eee915apull/191/head
parent
40d8172671
commit
de6d68238f
|
@ -26,6 +26,7 @@ Please mark all change in change log and use the ticket from JIRA.
|
|||
- MS-371 - Add TaskTableUpdatedEvent
|
||||
- MS-373 - Add resource test
|
||||
- MS-374 - Add action definition
|
||||
- MS-375 - Add Dump implementation for Event
|
||||
|
||||
## New Feature
|
||||
- MS-343 - Implement ResourceMgr
|
||||
|
|
|
@ -18,6 +18,14 @@ public:
|
|||
CopyCompletedEvent(std::weak_ptr<Resource> resource, TaskTableItemPtr task_table_item)
|
||||
: Event(EventType::COPY_COMPLETED, std::move(resource)),
|
||||
task_table_item_(std::move(task_table_item)) {}
|
||||
|
||||
inline std::string
|
||||
Dump() const override {
|
||||
return "<CopyCompletedEvent>";
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &out, const CopyCompletedEvent &event);
|
||||
|
||||
public:
|
||||
TaskTableItemPtr task_table_item_;
|
||||
};
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
|
@ -30,6 +32,13 @@ public:
|
|||
return type_;
|
||||
}
|
||||
|
||||
inline virtual std::string
|
||||
Dump() const {
|
||||
return "<Event>";
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &out, const Event &event);
|
||||
|
||||
public:
|
||||
EventType type_;
|
||||
std::weak_ptr<Resource> resource_;
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential.
|
||||
******************************************************************************/
|
||||
|
||||
#include "Event.h"
|
||||
#include "StartUpEvent.h"
|
||||
#include "CopyCompletedEvent.h"
|
||||
#include "FinishTaskEvent.h"
|
||||
#include "TaskTableUpdatedEvent.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const Event &event) {
|
||||
out << event.Dump();
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const StartUpEvent &event) {
|
||||
out << event.Dump();
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const CopyCompletedEvent &event) {
|
||||
out << event.Dump();
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const FinishTaskEvent &event) {
|
||||
out << event.Dump();
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const TaskTableUpdatedEvent &event) {
|
||||
out << event.Dump();
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,13 @@ public:
|
|||
: Event(EventType::FINISH_TASK, std::move(resource)),
|
||||
task_table_item_(std::move(task_table_item)) {}
|
||||
|
||||
inline std::string
|
||||
Dump() const override {
|
||||
return "<FinishTaskEvent>";
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &out, const FinishTaskEvent &event);
|
||||
|
||||
public:
|
||||
TaskTableItemPtr task_table_item_;
|
||||
};
|
||||
|
|
|
@ -17,6 +17,13 @@ public:
|
|||
explicit
|
||||
StartUpEvent(std::weak_ptr<Resource> resource)
|
||||
: Event(EventType::START_UP, std::move(resource)) {}
|
||||
|
||||
inline std::string
|
||||
Dump() const override {
|
||||
return "<StartUpEvent>";
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &out, const StartUpEvent &event);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,13 @@ public:
|
|||
explicit
|
||||
TaskTableUpdatedEvent(std::weak_ptr<Resource> resource)
|
||||
: Event(EventType::TASK_TABLE_UPDATED, std::move(resource)) {}
|
||||
|
||||
inline std::string
|
||||
Dump() const override {
|
||||
return "<TaskTableUpdatedEvent>";
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &out, const TaskTableUpdatedEvent &event);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue