Module util
///
A simple message rate limiter based on the token bucket algorithm.
Provides timed persistent data storage for class instances. TValue must implement the clone() method.
Summary
Members | Descriptions |
---|---|
namespace scy |
namespace scy
Summary
Members | Descriptions |
---|---|
class scy::AsyncDiagnostic |
|
class scy::Base64PacketEncoder |
|
class scy::BasicUser |
|
class scy::DiagnosticManager |
|
class scy::IDiagnostic |
|
class scy::IRegistry |
|
class scy::RateLimiter |
|
class scy::StreamManager |
|
class scy::TimedManager |
|
class scy::UserManager |
|
struct scy::DiagnosticState |
|
struct scy::IUser |
class scy::AsyncDiagnostic
class scy::AsyncDiagnostic
: public scy::IDiagnostic
: public scy::async::Runnable
Summary
Members | Descriptions |
---|---|
public inline virtual ~AsyncDiagnostic() |
|
public inline virtual void check() |
|
protected Thread _thread |
Members
public inline virtual ~AsyncDiagnostic()
public inline virtual void check()
protected
Thread
_thread
class scy::Base64PacketEncoder
class scy::Base64PacketEncoder
: public scy::PacketProcessor
Summary
Members | Descriptions |
---|---|
public PacketSignal emitter |
|
public inline Base64PacketEncoder() |
|
public inline virtual void process( IPacket & packet) |
Members
public
PacketSignal
emitter
public inline Base64PacketEncoder()
public inline virtual void process(
IPacket
& packet)
This method performs processing on the given packet and emits the result.
Note: If packet processing is async (the packet is not in the current thread scope) then packet data must be copied. Copied data can be freed directly aFter the async call to emit() the outgoing packet.
class scy::BasicUser
class scy::BasicUser
: public scy::IUser
Summary
Members | Descriptions |
---|---|
public inline BasicUser(const std::string & username,const std::string & password) |
|
public inline virtual std::string username() const |
|
public inline virtual std::string password() const |
|
protected std::string _username |
|
protected std::string _password |
Members
public inline BasicUser(const std::string & username,const std::string & password)
public inline virtual std::string username() const
public inline virtual std::string password() const
protected std::string _username
protected std::string _password
class scy::DiagnosticManager
class scy::DiagnosticManager
: public scy::PointerCollection< TKey, TValue, TDeleter >
Summary
Members | Descriptions |
---|---|
public NullSignal DiagnosticsComplete |
|
public DiagnosticManager() |
|
public virtual ~DiagnosticManager() |
|
public bool freeDiagnostic(const std::string & name) |
|
public bool addDiagnostic( IDiagnostic * test) |
Adds a IDiagnostic test instance. |
public virtual IDiagnostic * getDiagnostic(const std::string & name) |
|
public virtual void resetAll() |
|
public virtual void checkAll() |
|
public virtual bool allComplete() |
|
public virtual void onDiagnosticStateChange(void *, DiagnosticState & state,const DiagnosticState &) |
Members
public
NullSignal
DiagnosticsComplete
public DiagnosticManager()
public virtual ~DiagnosticManager()
public bool freeDiagnostic(const std::string & name)
public bool addDiagnostic(
IDiagnostic
* test)
Adds a IDiagnostic test instance.
public virtual
IDiagnostic
* getDiagnostic(const std::string & name)
Returns the IDiagnostic instance or throws a NotFoundException exception.
public virtual void resetAll()
public virtual void checkAll()
Runs all managed IDiagnostic tests. DiagnosticsComplete will be dispatched on completion.
public virtual bool allComplete()
public virtual void onDiagnosticStateChange(void *,
DiagnosticState
& state,const
DiagnosticState
&)
class scy::IDiagnostic
class scy::IDiagnostic
: public scy::Stateful< DiagnosticState >
Summary
Members | Descriptions |
---|---|
public std::string name |
The name of the diagnostic. |
public std::string description |
The diagnostic description. |
public std::vector< std::string > summary |
|
public Signal < const std::string & > SummaryUpdated |
|
public IDiagnostic() |
|
public virtual ~IDiagnostic() |
|
public virtual void check() |
|
public virtual void reset() |
|
public virtual bool complete() const |
|
public virtual bool passed() const |
|
public virtual bool failed() const |
|
protected void run() |
Override to implement diagnostic logic. |
protected virtual bool pass() |
|
protected virtual bool fail() |
|
protected virtual void addSummary(const std::string & text) |
Members
public std::string name
The name of the diagnostic.
public std::string description
The diagnostic description.
public std::vector< std::string > summary
The diagnostic summary, maybe including troubleshooting information on failure.
public
Signal
< const std::string & > SummaryUpdated
Signals when a new text item is added to the summary.
public IDiagnostic()
public virtual ~IDiagnostic()
public virtual void check()
public virtual void reset()
public virtual bool complete() const
public virtual bool passed() const
public virtual bool failed() const
protected void run()
Override to implement diagnostic logic.
The StateChange signal will dispatch diagnostic test results to delegates.
protected virtual bool pass()
protected virtual bool fail()
protected virtual void addSummary(const std::string & text)
class scy::IRegistry
Summary
Members | Descriptions |
---|---|
public Signal < const std::string & > TypeRegistered |
|
public Signal < const std::string & > TypeUnregistered |
|
public inline IRegistry() |
|
public inline virtual ~IRegistry() |
|
public inline virtual ItemT * createInstance(const std::string & s) |
|
public template<typename T> inline void registerType(const std::string & s) |
|
public inline virtual void unregisterType(const std::string & s) |
|
public inline TypeMap types() const |
Members
public
Signal
< const std::string & > TypeRegistered
public
Signal
< const std::string & > TypeUnregistered
public inline IRegistry()
public inline virtual ~IRegistry()
public inline virtual ItemT * createInstance(const std::string & s)
public template<typename T>
inline void registerType(const std::string & s)
public inline virtual void unregisterType(const std::string & s)
public inline TypeMap types() const
class scy::RateLimiter
Summary
Members | Descriptions |
---|---|
public double rate |
How many messages. |
public double seconds |
Over how many seconds. |
public double allowance |
Remaining send allowance. |
public clock_t lastCheck |
Last time canSend() was called. |
public inline RateLimiter(double rate,double seconds) |
|
public inline bool canSend() |
Members
public double rate
How many messages.
public double seconds
Over how many seconds.
public double allowance
Remaining send allowance.
public clock_t lastCheck
Last time canSend() was called.
public inline RateLimiter(double rate,double seconds)
public inline bool canSend()
class scy::StreamManager
class scy::StreamManager
: public scy::LiveCollection< PacketStream > >
: public scy::basic::Polymorphic
Summary
Members | Descriptions |
---|---|
public StreamManager(bool freeClosedStreams) |
|
public virtual ~StreamManager() |
|
public virtual bool addStream( PacketStream * stream,bool whiny) |
|
public virtual bool closeStream(const std::string & name,bool whiny) |
|
public virtual void closeAll() |
|
public virtual PacketStream * getStream(const std::string & name,bool whiny) |
|
public virtual PacketStream * getDafaultStream() |
Returns the first stream in the list, or NULL. |
public virtual Map streams() const |
|
public virtual void print(std::ostream & os) const |
|
protected bool _freeClosedStreams |
|
protected virtual void onAdd( PacketStream * task) |
Called after a stream is added. |
protected virtual void onRemove( PacketStream * task) |
Called after a stream is removed. |
protected virtual void onStreamStateChange(void * sender, PacketStreamState & state,const PacketStreamState &) |
|
protected inline virtual const char * className() const |
Members
public StreamManager(bool freeClosedStreams)
public virtual ~StreamManager()
public virtual bool addStream(
PacketStream
* stream,bool whiny)
public virtual bool closeStream(const std::string & name,bool whiny)
public virtual void closeAll()
public virtual
PacketStream
* getStream(const std::string & name,bool whiny)
public virtual
PacketStream
* getDafaultStream()
Returns the first stream in the list, or NULL.
public virtual Map streams() const
public virtual void print(std::ostream & os) const
protected bool _freeClosedStreams
protected virtual void onAdd(
PacketStream
* task)
Called after a stream is added.
protected virtual void onRemove(
PacketStream
* task)
Called after a stream is removed.
protected virtual void onStreamStateChange(void * sender,
PacketStreamState
& state,const
PacketStreamState
&)
protected inline virtual const char * className() const
class scy::TimedManager
class scy::TimedManager
: public scy::PointerCollection< TKey, TValue, TDeleter >
Summary
Members | Descriptions |
---|---|
public inline TimedManager(uv::Loop * loop) |
|
public inline virtual ~TimedManager() |
|
public inline virtual void add(const TKey & key,TValue * item,long timeout) |
|
public inline virtual bool expires(const TKey & key,long timeout) |
Update the item expiry timeout. |
public inline virtual bool expires(TValue * item,long timeout) |
Update the item expiry timeout. |
public inline virtual void clear() |
|
protected mutable Mutex _tmutex |
|
protected TimeoutMap _timeouts |
|
protected Timer _timer |
|
protected inline virtual bool setTimeout(TValue * item,long timeout) |
|
protected inline virtual void onRemove(const TKey & key,TValue * item) |
|
protected inline virtual void onTimeout(TValue * item) |
|
protected inline void onTimerUpdate(void *) |
Members
public inline TimedManager(uv::Loop * loop)
public inline virtual ~TimedManager()
public inline virtual void add(const TKey & key,TValue * item,long timeout)
Add an item which will expire (and be deleted) after the specified timeout value. If the timeout is 0 the item will be stored indefinitely. The TimedManager assumes ownership of the given pointer.
public inline virtual bool expires(const TKey & key,long timeout)
Update the item expiry timeout.
public inline virtual bool expires(TValue * item,long timeout)
Update the item expiry timeout.
public inline virtual void clear()
protected mutable
Mutex
_tmutex
protected TimeoutMap _timeouts
protected
Timer
_timer
protected inline virtual bool setTimeout(TValue * item,long timeout)
protected inline virtual void onRemove(const TKey & key,TValue * item)
protected inline virtual void onTimeout(TValue * item)
protected inline void onTimerUpdate(void *)
class scy::UserManager
class scy::UserManager
: public scy::LiveCollection< std::string, IUser >
Deprecated: This class contains a list of users that have access on the system.
Summary
Members | Descriptions |
---|---|
public inline UserManager() |
|
public inline virtual ~UserManager() |
|
public inline virtual bool add( IUser * user) |
Members
public inline UserManager()
public inline virtual ~UserManager()
public inline virtual bool add(
IUser
* user)
struct scy::DiagnosticState
struct scy::DiagnosticState
: public scy::State
Summary
Members | Descriptions |
---|---|
public inline virtual std::string str(unsigned int id) const |
Members
public inline virtual std::string str(unsigned int id) const
struct scy::IUser
Summary
Members | Descriptions |
---|---|
public std::string username() const |
|
public std::string password() const |