-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external") | ||
|
||
|
||
filegroup( | ||
name = "srcs", | ||
srcs = glob(["**"]), | ||
) | ||
|
||
cmake_external( | ||
name = "libevent", | ||
cache_entries = { | ||
"CMAKE_BUILD_TYPE": "Release", | ||
"CMAKE_POSITION_INDEPENDENT_CODE" : "on", | ||
"BUILD_SHARED_LIBS": "off", | ||
"BUILD_STATIC_LIBS": "on", | ||
"EVENT__DISABLE_OPENSSL": "on", | ||
"EVENT__DISABLE_REGRESS": "on", | ||
"EVENT__DISABLE_TESTS": "on", | ||
}, | ||
lib_source = ":srcs", | ||
static_libraries = ["libevent.a"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk { | ||
namespace common { | ||
#ifdef _WIN32 | ||
using FileDescriptor = intptr_t; | ||
#else | ||
using FileDescriptor = int; | ||
#endif | ||
} // namespace common | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "opentelemetry/sdk/common/file_descriptor.h" | ||
#include "opentelemetry/sdk/event/file_event.h" | ||
#include "opentelemetry/sdk/event/timer.h" | ||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk { | ||
namespace event { | ||
class Dispatcher { | ||
public: | ||
virtual ~Dispatcher() = default; | ||
|
||
virtual std::unique_ptr<FileEvent> CreateFileEvent(FileDescriptor file_descriptor, | ||
FileReadyCallback callback, | ||
uint32_t events) noexcept = 0; | ||
|
||
virtual std::unique_ptr<Timer> CreateTimer(TimerCallback callback) noexcept = 0; | ||
|
||
virtual void Exit() noexcept = 0; | ||
|
||
virtual void Run() noexcept = 0; | ||
}; | ||
} // namespace event | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <chrono> | ||
#include <system_error> | ||
#include <cstdint> | ||
#include <functional> | ||
|
||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk { | ||
namespace event { | ||
struct FileReadyType { | ||
static const uint32_t kRead = 1; | ||
static const uint32_t kWrite = 2; | ||
static const uint32_t kClosed = 3; | ||
static const uint32_t kTimeout = 4; | ||
}; | ||
|
||
using FileReadyCallback = std::function<void(uint32_t)>; | ||
|
||
class FileEvent { | ||
public: | ||
virtual ~FileEvent() = default; | ||
|
||
}; | ||
} // namespace event | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include <chrono> | ||
#include <system_error> | ||
#include <functional> | ||
|
||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk { | ||
namespace event { | ||
using TimerCallback = std::function<void()>; | ||
|
||
class Timer { | ||
public: | ||
virtual ~Timer() = default; | ||
|
||
virtual void EnableTimer(std::chrono::microseconds timeout, | ||
std::error_code &error_code) noexcept = 0; | ||
}; | ||
} // namespace event | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |