Namespaces
Classes
A "process identifier" used to uniquely identify a process when dispatching messages.
More...
Represents a fork() exec()ed subprocess.
More...
An "untyped"
PID , used to encapsulate the process
ID for lower-layer abstractions (eg, when receiving incoming requests) in the dispatching mechanism.
More...
Typedefs
Enumerations
Functions
template<typename F >
Future< typename result_of< F()>::type >
async (const F &
f, typename std::enable_if<!std::is_void< typename result_of< F()>::type >::value >::type *=nullptr)
template<typename F >
Future<
Nothing >
async (const F &
f, typename std::enable_if< std::is_void< typename result_of< F()>::type >::value >::type *=nullptr)
template<typename T >
template<typename... Ts>
template<typename T >
template<typename... Ts>
template<typename T >
template<typename T >
template<typename T >
template<typename T >
template<typename R , typename T >
template<typename R , typename T >
template<typename R , typename T >
template<typename R , typename T >
template<typename F >
template<typename T >
template<typename T >
template<typename T >
template<typename T >
void
dispatch (const
PID< T > &pid, void(T::*method)())
template<typename T >
template<typename T >
template<typename R , typename T >
template<typename R , typename T >
template<typename R , typename T >
template<typename R , typename T >
template<typename T >
template<typename Futures >
void
discard (const Futures &futures)
template<typename T >
template<typename T >
template<typename T >
template<typename T >
template<typename T >
template<typename T >
template<typename F , typename std::enable_if< !is_specialization_of< typename std::decay< F >::type, Future >::value, int >::type = 0>
MATCHER_P3 (UnionMessageMatcher, message, unionType, from,"")
MATCHER_P3 (HttpMatcher, message, path, deserializer,"")
MATCHER_P4 (UnionHttpMatcher, message, unionType, path, deserializer,"")
template<typename Message , typename Path , typename Deserializer >
template<typename Message , typename UnionType , typename Path , typename Deserializer >
template<typename Name , typename From , typename To >
template<typename Message , typename UnionType , typename From , typename To >
template<typename PID , typename Method >
template<typename Name , typename From , typename To >
template<typename Message , typename UnionType , typename From , typename To >
template<typename Message , typename Path , typename Deserializer >
template<typename Message , typename UnionType , typename Path , typename Deserializer >
template<typename Message , typename Path , typename Deserializer >
template<typename Message , typename UnionType , typename Path , typename Deserializer >
template<typename Name , typename From , typename To >
template<typename Message , typename UnionType , typename From , typename To >
template<typename PID , typename Method >
template<typename PID , typename Method >
template<typename From , typename To >
std::string
HELP (const std::string &tldr, const
Option< std::string > &description=
None(), const
Option< std::string > &authentication=
None(), const
Option< std::string > &authorization=
None(), const
Option< std::string > &references=
None())
std::string
USAGE (const std::string &usage)
std::string
TLDR (const std::string &tldr)
template<typename... T>
template<typename... T>
template<typename... T>
template<typename Iterate , typename Body , typename T = typename internal::unwrap<typename result_of<Iterate()>::type>::type, typename CF = typename internal::unwrap<typename result_of<Body(T)>::type>::type, typename V = typename CF::ValueType>
template<typename Iterate , typename Body , typename T = typename internal::unwrap<typename result_of<Iterate()>::type>::type, typename CF = typename internal::unwrap<typename result_of<Body(T)>::type>::type, typename V = typename CF::ValueType>
template<typename T >
Get the request absolutePath path with delegate prefix.
More...
Returns the socket address associated with this instance of the library.
More...
Return the
PID associated with the global logging process.
More...
Returns the number of worker threads the library has created.
More...
template<typename T >
PID< T >
spawn (T *t, bool manage=false)
template<typename T >
PID< T >
spawn (T &t, bool manage=false)
Wait for the process to exit for no more than the specified seconds.
More...
Wait for the process to exit for no more than the specified seconds.
More...
Wait for the process to exit for no more than the specified seconds.
More...
void
post (const
UPID &to, const std::string &name, const char *data=nullptr, size_t length=0)
Sends a message with data without a return address.
More...
void
post (const
UPID &from, const
UPID &to, const std::string &name, const char *data=nullptr, size_t length=0)
template<typename R >
Try<
Subprocess >
subprocess (const std::string &path, std::vector< std::string > argv, const
Subprocess::IO &in=
Subprocess::FD(
STDIN_FILENO), const
Subprocess::IO &out=
Subprocess::FD(
STDOUT_FILENO), const
Subprocess::IO &err=
Subprocess::FD(
STDERR_FILENO), const
flags::FlagsBase *
flags=nullptr, const
Option< std::map< std::string, std::string >> &environment=
None(), const
Option< lambda::function<
pid_t(const lambda::function< int()> &)>> &clone=
None(), const std::vector<
Subprocess::ParentHook > &parent_hooks={}, const std::vector<
Subprocess::ChildHook > &child_hooks={}, const std::vector<
int_fd > &whitelist_fds={})
Forks a subprocess and execs the specified 'path' with the specified 'argv', redirecting stdin, stdout, and stderr as specified by 'in', 'out', and 'err' respectively.
More...
Overload of 'subprocess' for launching a shell command, i.e., 'sh -c command'.
More...
template<typename T >
template<typename T >
Variables
std::queue< lambda::function< void()> > *
functions
Typedef Documentation
Enumeration Type Documentation
| Enumerator |
|---|
| ALLOW_SHORT_CIRCUIT |
| DISALLOW_SHORT_CIRCUIT |
Function Documentation
template<typename T >
void process::_run_in_event_loop
(
struct ev_loop *
loop,
const lambda::function<
Future< T >(struct ev_loop *)> &
f,
)
std::string process::absolutePath
(
const std::string &
path )
Get the request absolutePath path with delegate prefix.
Returns the socket address associated with this instance of the library.
template<typename F >
Future< typename result_of< F()>::type > process::async
(
const F &
f,
typename std::enable_if<!std::is_void< typename result_of< F()>::type >::value >::type *
= nullptr
)
template<typename F >
typename std::enable_if< std::is_void< typename result_of< F()>::type >::value >::type *
= nullptr
)
std::string process::AUTHENTICATION
(
bool
required )
inline |
template<typename... T>
std::string process::AUTHORIZATION
(
T &&...
args )
inline |
template<typename T >
Future< std::vector<
Future< T > > > process::await
(
const std::vector<
Future< T >> &
futures )
inline |
template<typename... Ts>
Future< std::tuple<
Future< Ts >... > > process::await
(
const
Future< Ts > &...
futures )
template<typename T >
ControlFlow<typename std::decay<T>::type>::Break process::Break
(
T &&
t )
template<typename T >
Future< std::vector< T > > process::collect
(
const std::vector<
Future< T >> &
futures )
inline |
template<typename... Ts>
Future< std::tuple< Ts... > > process::collect
(
const
Future< Ts > &...
futures )
template<typename T >
Deferred<void()> process::defer
(
const
PID< T > &
pid,
void(T::*)()
method
)
template<typename T >
void(T::*)()
method
)
template<typename T >
void(T::*)()
method
)
template<typename R , typename T >
)
template<typename R , typename T >
)
template<typename R , typename T >
R(T::*)()
method
)
template<typename R , typename T >
R(T::*)()
method
)
template<typename T >
void(T::*)()
method
)
template<typename T >
void(T::*)()
method
)
template<typename T >
void(T::*)()
method
)
template<typename... T>
std::string process::DESCRIPTION
(
T &&...
args )
inline |
template<typename Futures >
void process::discard
(
const Futures &
futures )
template<typename T >
void process::discardPromises
(
std::set<
Promise< T > * > *
promises )
template<typename T >
void process::discardPromises
(
std::set<
Promise< T > * > *
promises,
)
template<typename T >
void process::dispatch
(
const
PID< T > &
pid,
void(T::*)()
method
)
template<typename T >
void process::dispatch
(
const
Process< T > &
process,
void(T::*)()
method
)
template<typename T >
void process::dispatch
(
const
Process< T > *
process,
void(T::*)()
method
)
T
Future<R> process::dispatch
(
const
PID< T > &
pid,
)
template<typename R , typename T >
)
template<typename R , typename T >
)
T
Future<R> process::dispatch
(
const
PID< T > &
pid,
R(T::*)()
method
)
template<typename R , typename T >
R(T::*)()
method
)
template<typename R , typename T >
R(T::*)()
method
)
template<typename PID , typename Method >
void process::DropDispatches
(
PID
pid,
Method
method
)
template<typename Message , typename Path , typename Deserializer >
void process::DropHttpRequests
(
Message
message,
Deserializer
deserializer,
bool
drop = false
)
template<typename Name , typename From , typename To >
void process::DropMessages
(
Name
name,
From
from,
To
to
)
template<typename Message , typename UnionType , typename Path , typename Deserializer >
void process::DropUnionHttpRequests
(
Message
message,
UnionType
unionType,
Deserializer
deserializer,
bool
drop = false
)
template<typename Message , typename UnionType , typename From , typename To >
void process::DropUnionMessages
(
Message
message,
UnionType
unionType,
From
from,
To
to
)
template<typename PID , typename Method >
void process::ExpectNoFutureDispatches
(
PID
pid,
Method
method
)
template<typename Message , typename Path , typename Deserializer >
void process::ExpectNoFutureHttpRequests
(
Message
message,
Deserializer
deserializer,
bool
drop = false
)
template<typename Name , typename From , typename To >
void process::ExpectNoFutureMessages
(
Name
name,
From
from,
To
to
)
template<typename Message , typename UnionType , typename Path , typename Deserializer >
void process::ExpectNoFutureUnionHttpRequests
(
Message
message,
UnionType
unionType,
Deserializer
deserializer,
bool
drop = false
)
template<typename Message , typename UnionType , typename From , typename To >
void process::ExpectNoFutureUnionMessages
(
Message
message,
UnionType
unionType,
From
from,
To
to
)
template<typename T >
void process::failPromises
(
std::set<
Promise< T > * > *
promises,
const std::string &
failure
)
void process::filter
(
Filter *
filter )
void process::finalize
(
bool
finalize_wsa = false )
Clean up the library.
- Parameters
-
finalize_wsa Whether the Windows socket stack should be cleaned up for the entire process. Has no effect outside of Windows.
template<typename PID , typename Method >
Method
method,
bool
drop = false
)
template<typename From , typename To >
To
to,
bool
drop = false
)
template<typename Message , typename Path , typename Deserializer >
Deserializer
deserializer,
bool
drop = false
)
template<typename Name , typename From , typename To >
From
from,
To
to,
bool
drop = false
)
template<typename Message , typename UnionType , typename Path , typename Deserializer >
UnionType
unionType,
Deserializer
deserializer,
bool
drop = false
)
template<typename Message , typename UnionType , typename From , typename To >
UnionType
unionType,
From
from,
To
to,
bool
drop = false
)
std::string process::HELP
(
const std::string &
tldr,
const
Option< std::string > &
description =
None(),
const
Option< std::string > &
authentication =
None(),
const
Option< std::string > &
authorization =
None(),
)
bool process::initialize
(
const
Option< std::string > &
delegate =
None(),
const
Option< std::string > &
readwriteAuthenticationRealm =
None(),
const
Option< std::string > &
readonlyAuthenticationRealm =
None()
)
Initialize the library.
NOTE: libprocess uses Google's glog and you can specify options for it (e.g., a logging directory) via environment variables.
- Parameters
-
delegate
Process to receive root HTTP requests.
readwriteAuthenticationRealm The authentication realm that read-write libprocess-level HTTP endpoints will be installed under, if any. If this realm is not specified, read-write endpoints will be installed without authentication.
readonlyAuthenticationRealm The authentication realm that read-only libprocess-level HTTP endpoints will be installed under, if any. If this realm is not specified, read-only endpoints will be installed without authentication.
- Returns
true if this was the first invocation of process::initialize() , or false if it was not the first invocation.
- See also
- glog
Return the PID associated with the global logging process.
template<typename Iterate , typename Body , typename T = typename internal::unwrap<typename result_of<Iterate()>::type>::type, typename CF = typename internal::unwrap<typename result_of<Body(T)>::type>::type, typename V = typename CF::ValueType>
Iterate &&
iterate,
Body &&
body
)
template<typename Iterate , typename Body , typename T = typename internal::unwrap<typename result_of<Iterate()>::type>::type, typename CF = typename internal::unwrap<typename result_of<Body(T)>::type>::type, typename V = typename CF::ValueType>
Future<V> process::loop
(
Iterate &&
iterate,
Body &&
body
)
process::MATCHER_P
(
DispatchMatcher
,
method
,
""
)
process::MATCHER_P
(
ExitedMatcher
,
from
,
""
)
process::MATCHER_P2
(
MessageMatcher
,
name
,
from
,
""
)
process::MATCHER_P3
(
UnionMessageMatcher
,
message
,
unionType
,
from
,
""
)
process::MATCHER_P3
(
HttpMatcher
,
message
,
path
,
deserializer
,
""
)
process::MATCHER_P4
(
UnionHttpMatcher
,
message
,
unionType
,
path
,
deserializer
,
""
)
bool process::operator!=
(
const std::string &
s,
)
inline |
std::string process::operator+
(
const
UPID::ID &
id,
const std::string &
s
)
inline |
std::string process::operator+
(
const
UPID::ID &
id,
std::string &&
s
)
inline |
std::string process::operator+
(
const std::string &
s,
)
inline |
std::string process::operator+
(
std::string &&
s,
)
inline |
std::ostream& process::operator<<
(
std::ostream &
stream,
)
std::ostream& process::operator<<
(
std::ostream &
stream,
)
std::ostream& process::operator<<
(
std::ostream &
stream,
)
inline |
std::ostream& process::operator<<
(
std::ostream &
stream,
)
inline |
std::ostream& process::operator<<
(
std::ostream &
,
)
template<typename T >
std::ostream& process::operator<<
(
std::ostream &
stream,
)
bool process::operator==
(
const std::string &
s,
)
inline |
std::istream& process::operator>>
(
std::istream &
,
)
const google::protobuf::Message &
message
)
inline |
const google::protobuf::Message &
message
)
inline |
void process::post
(
const
UPID &
to,
const std::string &
name,
const char *
data = nullptr,
size_t
length = 0
)
Sends a message with data without a return address.
- Parameters
-
to Receiver of the message.
name Name of the message.
data Data to send (gets copied).
length Length of data.
void process::post
(
const
UPID &
from,
const std::string &
name,
const char *
data = nullptr,
size_t
length = 0
)
template<typename... T>
std::string process::REFERENCES
(
T &&...
args )
inline |
process::REPEAT_FROM_TO
(
1
,
13
,
_
)
template<typename R >
Future<R> process::run
(
R(*)()
method )
void process::run_in_event_loop
(
const lambda::function< void()> &
f,
)
template<typename T >
const lambda::function<
Future< T >(struct ev_loop *)> &
f
)
template<typename T >
void process::setPromises
(
std::set<
Promise< T > * > *
promises,
const T &
t
)
Spawn a new process.
- Parameters
-
manage Whether process should get deleted by the runtime after terminating.
bool
manage = false
)
inline |
template<typename T >
PID<T> process::spawn
(
T *
t,
bool
manage = false
)
template<typename T >
PID<T> process::spawn
(
T &
t,
bool
manage = false
)
std::vector< std::string >
argv,
const
Option< std::map< std::string, std::string >> &
environment =
None(),
const
Option< lambda::function<
pid_t(const lambda::function< int()> &)>> &
clone =
None(),
const std::vector<
int_fd > &
whitelist_fds =
{}
)
Forks a subprocess and execs the specified 'path' with the specified 'argv', redirecting stdin, stdout, and stderr as specified by 'in', 'out', and 'err' respectively.
- Parameters
-
path Relative or absolute path in the filesytem to the executable.
argv Argument vector to pass to exec.
in Redirection specification for stdin.
out Redirection specification for stdout.
err Redirection specification for stderr.
flags Flags to be stringified and appended to 'argv'.
environment Environment variables to use for the new subprocess or if
None (the default) then the new subprocess will inherit the environment of the current process.
clone Function to be invoked in order to fork/clone the subprocess.
parent_hooks Hooks that will be executed in the parent before the child execs.
child_hooks Hooks that will be executed in the child before the child execs but after parent_hooks have executed.
- Returns
- The subprocess or an error if one occurred.
Try<
Subprocess> process::subprocess
(
const std::string &
command,
const
Option< std::map< std::string, std::string >> &
environment =
None(),
const
Option< lambda::function<
pid_t(const lambda::function< int()> &)>> &
clone =
None(),
const std::vector<
int_fd > &
whitelist_fds =
{}
)
inline |
Overload of 'subprocess' for launching a shell command, i.e., 'sh -c command'.
Currently, we do not support flags for shell command variants due to the complexity involved in escaping quotes in flags.
- Parameters
-
command Shell command to execute.
in Redirection specification for stdin.
out Redirection specification for stdout.
err Redirection specification for stderr.
environment Environment variables to use for the new subprocess or if
None (the default) then the new subprocess will inherit the environment of the current process.
clone Function to be invoked in order to fork/clone the subprocess.
parent_hooks Hooks that will be executed in the parent before the child execs.
child_hooks Hooks that will be executed in the child before the child execs but after parent_hooks have executed.
- Returns
- The subprocess or an error if one occurred.
void process::terminate
(
const
UPID &
pid,
bool
inject = true
)
Sends a TerminateEvent to the given process.
NOTE: currently, terminate only works for local processes (in the future we plan to make this more explicit via the use of a PID instead of a UPID ).
- Parameters
-
pid The process to terminate.
inject Whether the message should be injected ahead of all other messages queued up for that process.
- See also
- process::TerminateEvent
Sends a TerminateEvent to the given process.
NOTE: currently, terminate only works for local processes (in the future we plan to make this more explicit via the use of a PID instead of a UPID ).
- Parameters
-
pid The process to terminate.
inject Whether the message should be injected ahead of all other messages queued up for that process.
- See also
- process::TerminateEvent
Sends a TerminateEvent to the given process.
NOTE: currently, terminate only works for local processes (in the future we plan to make this more explicit via the use of a PID instead of a UPID ).
- Parameters
-
pid The process to terminate.
inject Whether the message should be injected ahead of all other messages queued up for that process.
- See also
- process::TerminateEvent
std::string process::TLDR
(
const std::string &
tldr )
inline |
template<typename T >
Future<T> process::undiscardable
(
const
Future< T > &
future )
template<typename F , typename std::enable_if< !is_specialization_of< typename std::decay< F >::type, Future >::value, int >::type = 0>
std::string process::USAGE
(
const std::string &
usage )
inline |
bool process::wait
(
const
UPID &
pid,
)
Wait for the process to exit for no more than the specified seconds.
- Parameters
-
secs Max time to wait, 0 implies wait forever.
- Returns
- true if a process was actually waited upon.
Wait for the process to exit for no more than the specified seconds.
- Parameters
-
secs Max time to wait, 0 implies wait forever.
- Returns
- true if a process was actually waited upon.
Wait for the process to exit for no more than the specified seconds.
- Parameters
-
secs Max time to wait, 0 implies wait forever.
- Returns
- true if a process was actually waited upon.
long process::workers
(
)
Returns the number of worker threads the library has created.
A worker thread is a thread that runs a process (i.e., calls ProcessBase::serve ).
Variable Documentation
thread_local
Executor* process::_executor_
thread_local bool * process::_in_event_loop_
ev_async* process::async_watchers
event_base* process::base
Initial value:{
return _Deferred<F>(pid, std::forward<F>(
f))
F && f
Definition: defer.hpp:270
std::queue<lambda::function<void()> >* process::functions
std::mutex* process::functions_mutexes
const uint32_t process::GZIP_MINIMUM_BODY_LENGTH = 1024
struct ev_loop** process::loops
constexpr char process::READONLY_HTTP_AUTHENTICATION_REALM[] = "libprocess-readonly"
constexpr char process::READWRITE_HTTP_AUTHENTICATION_REALM[] = "libprocess-readwrite"
constexpr size_t process::TIME_SERIES_CAPACITY = 1000
Generated by
doxygen
1.8.11