Skip to content

Commit

Permalink
Remove deprecated symbols and deprecate symbols that have been schedu…
Browse files Browse the repository at this point in the history
…led for deprecation.
  • Loading branch information
s-ludwig committed Apr 12, 2014
1 parent a5eee15 commit 3c405e4
Show file tree
Hide file tree
Showing 27 changed files with 126 additions and 288 deletions.
13 changes: 8 additions & 5 deletions source/vibe/core/core.d
Expand Up @@ -526,6 +526,7 @@ FileDescriptorEvent createFileDescriptorEvent(int file_descriptor, FileDescripto
This function also works if called from outside if a fiber. In this
case, it will work on a thread local storage.
*/
deprecated("Please use TaskLocal instead.")
void setTaskLocal(T)(string name, T value)
{
auto self = cast(CoreTask)Fiber.getThis();
Expand All @@ -534,14 +535,15 @@ void setTaskLocal(T)(string name, T value)
}

/**
Returns a task/fiber specific variable. Scheduled for deprecation.
Deprecated. Returns a task/fiber specific variable.
Please use TaskLocal instead.
Remarks:
This function also works if called from outside if a fiber. In this
case, it will work on a thread local storage.
*/
deprecated("Please use TaskLocal instead.")
T getTaskLocal(T)(string name)
{
auto self = cast(CoreTask)Fiber.getThis();
Expand All @@ -552,14 +554,15 @@ T getTaskLocal(T)(string name)
}

/**
Returns a task/fiber specific variable. Scheduled for deprecation.
Deprecated. Returns a task/fiber specific variable.
Please use TaskLocal instead.
Remarks:
This function also works if called from outside if a fiber. In this
case, it will work on a thread local storage.
*/
deprecated("Please use TaskLocal instead.")
bool isTaskLocalSet(string name)
{
auto self = cast(CoreTask)Fiber.getThis();
Expand All @@ -584,15 +587,15 @@ void setTaskStackSize(size_t sz)
}

/**
Compatibility stub - will be deprecated soon.
Deprecated compatibility stub.
This function was used to start the worker threads necessary for
runWorkerTask and runWorkerTaskDist. These threads are now started
automatically, so there is no need to call this function anymore
*/
void enableWorkerThreads()
deprecated void enableWorkerThreads()
{
logDiagnostic("enableWorkerThreads() does nothing and will be deprecated soon.");
logDiagnostic("enableWorkerThreads() does nothing and will be removed soon.");
}


Expand Down
12 changes: 0 additions & 12 deletions source/vibe/core/driver.d
Expand Up @@ -91,9 +91,6 @@ interface EventDriver {
*/
TCPConnection connectTCP(NetworkAddress address);

/// Deprecated compatibility alias
deprecated("Please use connectTCP instead.") alias connectTcp = connectTCP;

/** Listens on the specified port and interface for TCP connections.
'bind_address' must be an IPv4 or IPv6 address string corresponding to a local network
Expand All @@ -102,19 +99,13 @@ interface EventDriver {
*/
TCPListener listenTCP(ushort port, void delegate(TCPConnection conn) conn_callback, string bind_address, TCPListenOptions options);

/// Deprecated compatibility alias
deprecated("Please use listenTCP instead.") alias listenTcp = listenTCP;

/** Creates a new UDP socket and sets the specified address/port as the destination for packets.
If a bind port is specified, the socket will be able to receive UDP packets on that port.
Otherwise, a random bind port is chosen.
*/
UDPConnection listenUDP(ushort port, string bind_address = "0.0.0.0");

/// Deprecated compatibility alias
deprecated("Please use listenUDP instead.") alias listenUdp = listenUDP;

/** Creates a new manually triggered event.
*/
ManualEvent createManualEvent();
Expand All @@ -123,9 +114,6 @@ interface EventDriver {
*/
FileDescriptorEvent createFileDescriptorEvent(int file_descriptor, FileDescriptorEvent.Trigger triggers);

/// Deprecated compatibility alias
deprecated("Please use createNanualEvent instead.") alias createSignal = createManualEvent;

/** Creates a new timer.
The timer can be started by calling rearmTimer() with a timeout.
Expand Down
7 changes: 4 additions & 3 deletions source/vibe/core/log.d
Expand Up @@ -33,12 +33,13 @@ nothrow {


/**
Enables/disables output of thread/task ids with each log message-
Deprecated. Enables/disables output of thread/task ids with each log message.
By default, only the log message is displayed (enable=true).
This method is scheduled for deprecation. Please use setLogFormat instead.
Please use setLogFormat with FileLogger.Format.plain or FileLogger.Format.thread instead.
*/
deprecated("Use setLogFormat instead.")
void setPlainLogging(bool enable)
{
assert(ss_stdoutLogger !is null, "Console logging disabled du to missing console.");
Expand Down Expand Up @@ -700,7 +701,7 @@ package void initializeLogModule()

foreach_reverse (i, v; verbose)
if (v) {
setPlainLogging(false);
setLogFormat(FileLogger.Format.thread);
setLogLevel(cast(LogLevel)(LogLevel.diagnostic - i));
break;
}
Expand Down
24 changes: 0 additions & 24 deletions source/vibe/core/net.d
Expand Up @@ -59,9 +59,6 @@ TCPListener listenTCP(ushort port, void delegate(TCPConnection stream) connectio
return getEventDriver().listenTCP(port, connection_callback, address, options);
}

/// Deprecated compatibility alias
deprecated("Please use listenTCP instead.") alias listenTcp = listenTCP;

/**
Starts listening on the specified port.
Expand All @@ -77,9 +74,6 @@ TCPListener listenTCP_s(ushort port, void function(TCPConnection stream) connect
return listenTCP(port, toDelegate(connection_callback), address, options);
}

/// Deprecated compatibility alias
deprecated("Please use listenTCP_s instead.") alias listenTcpS = listenTCP_s;

/**
Establishes a connection to the given host/port.
*/
Expand All @@ -94,9 +88,6 @@ TCPConnection connectTCP(NetworkAddress addr) {
return getEventDriver().connectTCP(addr);
}

/// Deprecated compatibility alias
deprecated("Please use connectTCP instead.")alias connectTcp = connectTCP;


/**
Creates a bound UDP socket suitable for sending and receiving packets.
Expand All @@ -106,9 +97,6 @@ UDPConnection listenUDP(ushort port, string bind_address = "0.0.0.0")
return getEventDriver().listenUDP(port, bind_address);
}

/// Deprecated compatibility alias
deprecated("Please use listenUDP instead.")alias listenUdp = listenUDP;


/**
Represents a network/socket address.
Expand Down Expand Up @@ -242,9 +230,6 @@ interface TCPConnection : ConnectionStream {
@property NetworkAddress remoteAddress() const;
}

/// Deprecated compatibility alias
deprecated("Please use TCPConnection instead.")alias TcpConnection = TCPConnection;


/**
Represents a listening TCP socket.
Expand All @@ -254,9 +239,6 @@ interface TCPListener {
void stopListening();
}

/// Deprecated compatibility alias
deprecated("Please use TCPListener instead.")alias TcpListener = TCPListener;


/**
Represents a bound and possibly 'connected' UDP socket.
Expand Down Expand Up @@ -298,18 +280,12 @@ interface UDPConnection {
ubyte[] recv(ubyte[] buf = null, NetworkAddress* peer_address = null);
}

/// Deprecated compatibility alias
deprecated("Please use UDPConnection instead.")alias UdpConnection = UDPConnection;


enum TCPListenOptions {
defaults = 0,
distribute = 1<<0
}

/// Deprecated compatibility alias
deprecated("Please use TCPListenOptions instead.")alias TcpListenOptions = TCPListenOptions;

private pure nothrow {
import std.bitmanip;

Expand Down
9 changes: 6 additions & 3 deletions source/vibe/core/task.d
Expand Up @@ -125,19 +125,21 @@ class TaskFiber : Fiber {
*/
abstract void terminate();

/** Sets a task local variable. Will be deprecated soon.
/** Deprecated. Sets a task local variable.
Please use vibe.core.core.TaskLocal instead.
*/
deprecated("Please use vibe.core.core.TaskLocal instead.")
void set(T)(string name, T value)
{
m_taskLocalStorage[name] = Variant(value);
}

/** Returns a task local variable. Will be deprecated soon.
/** Deprecated. Returns a task local variable.
Please use vibe.core.core.TaskLocal instead.
*/
deprecated("Please use vibe.core.core.TaskLocal instead.")
T get(T)(string name)
{
Variant* pvar;
Expand All @@ -146,10 +148,11 @@ class TaskFiber : Fiber {
return pvar.get!T();
}

/** Determines if a certain task local variable is set. Will be deprecated soon.
/** Deprecated. Determines if a certain task local variable is set.
Please use vibe.core.core.TaskLocal instead.
*/
deprecated("Please use vibe.core.core.TaskLocal instead.")
bool isSet(string name)
{
return (name in m_taskLocalStorage) !is null;
Expand Down
6 changes: 4 additions & 2 deletions source/vibe/data/bson.d
Expand Up @@ -82,9 +82,11 @@ struct Bson {
/// Returns a new, empty Bson value of type Object.
static @property Bson emptyArray() { return Bson(cast(Bson[])null); }

/// Compatibility alias - will be deprecated soon.
/// Deprecated compatibility alias.
deprecated("Please use emptyObject instead.")
alias EmptyObject = emptyObject;
/// Compatibility alias - will be deprecated soon.
/// Deprecated compatibility alias.
deprecated("Please use emptyArray instead.")
alias EmptyArray = emptyArray;

private {
Expand Down
7 changes: 0 additions & 7 deletions source/vibe/data/json.d
Expand Up @@ -121,13 +121,6 @@ struct Json {
/// New JSON value of Type.Array
static @property Json emptyArray() { return Json(cast(Json[])null); }

/// Deprecated compatibility alias
deprecated("Please use undefined instead.") alias Undefined = undefined;
/// ditto
deprecated("Please use emptyObject instead.") alias EmptyObject = emptyObject;
/// ditto
deprecated("Please use emptyArray instead.") alias EmptyArray = emptyArray;

version(JsonLineNumbers) int line;

/**
Expand Down
6 changes: 3 additions & 3 deletions source/vibe/db/mongo/connection.d
Expand Up @@ -139,12 +139,12 @@ class MongoConnection {
try {
m_conn = connectTCP(m_settings.hosts[0].name, m_settings.hosts[0].port);
if (m_settings.ssl) {
auto ctx = new SSLContext(SSLContextKind.client);
auto ctx = createSSLContext(SSLContextKind.client);
if (!m_settings.sslverifycertificate) {
ctx.peerValidationMode = SSLPeerValidationMode.none;
}

m_stream = new SSLStream(m_conn, ctx);
m_stream = createSSLStream(m_conn, ctx);
}
else {
m_stream = m_conn;
Expand Down Expand Up @@ -428,7 +428,7 @@ class MongoConnection {
}
string nonce = doc["nonce"].get!string;
string key = toLower(toHexString(md5Of(nonce ~ m_settings.username ~ m_settings.digest)).idup);
cmd = Bson.EmptyObject;
cmd = Bson.emptyObject;
cmd["authenticate"] = Bson(1);
cmd["nonce"] = Bson(nonce);
cmd["user"] = Bson(m_settings.username);
Expand Down
8 changes: 5 additions & 3 deletions source/vibe/db/redis/redis.d
Expand Up @@ -67,11 +67,13 @@ final class RedisClient {
/// Returns Redis version
@property string redisVersion() { return m_version; }

/// will get deprecated in 0.7.20
deprecated("Use getDatabase() to access individual databases instead.")
@property RedisDatabase selectedDB() { return getDatabase(m_selectedDB); }
/// will get deprecated in 0.7.20

deprecated("Use getDatabase() to access individual databases instead.")
void select(long db_index) { m_selectedDB = db_index; }
/// will get deprecated in 0.7.20

deprecated("Use getDatabase() to access individual databases.")
alias selectedDB this;

/** Returns a handle to the given database.
Expand Down
22 changes: 2 additions & 20 deletions source/vibe/http/client.d
Expand Up @@ -134,9 +134,6 @@ unittest {
}
}

/// Deprecated compatibility alias
deprecated("Please use requestHTTP instead.") alias requestHttp = requestHTTP;


/**
Returns a HttpClient proxy object that is connected to the specified host.
Expand Down Expand Up @@ -171,9 +168,6 @@ auto connectHTTP(string host, ushort port = 0, bool ssl = false)
return pool.lockConnection();
}

/// Deprecated compatibility alias
deprecated("Please use connectHTTP instead.") alias connectHttp = connectHTTP;


/**************************************************************************************************/
/* Public types */
Expand All @@ -189,9 +183,6 @@ deprecated("Please use connectHTTP instead.") alias connectHttp = connectHTTP;
class HTTPClient {
enum maxHeaderLineLength = 4096;

/// Deprecated compatibility alias
deprecated("Please use maxHeaderLineLength instead.") enum maxHttpHeaderLineLength = maxHeaderLineLength;

private {
string m_server;
ushort m_port;
Expand Down Expand Up @@ -232,7 +223,7 @@ class HTTPClient {
m_server = server;
m_port = port;
if (ssl) {
m_ssl = new SSLContext(SSLContextKind.client);
m_ssl = createSSLContext(SSLContextKind.client);
// this will be changed to trustedCert once a proper root CA store is available by default
m_ssl.peerValidationMode = SSLPeerValidationMode.none;
if (ms_sslSetup) ms_sslSetup(m_ssl);
Expand Down Expand Up @@ -337,7 +328,7 @@ class HTTPClient {
if (m_conn) m_conn.close(); // make sure all resources are freed
m_conn = connectTCP(m_server, m_port);
m_stream = m_conn;
if (m_ssl) m_stream = new SSLStream(m_conn, m_ssl, SSLStreamState.connecting, m_server, m_conn.remoteAddress);
if (m_ssl) m_stream = createSSLStream(m_conn, m_ssl, SSLStreamState.connecting, m_server, m_conn.remoteAddress);

now = Clock.currTime(UTC());
}
Expand All @@ -357,9 +348,6 @@ class HTTPClient {
}
}

/// Deprecated compatibility alias
deprecated("Please use HTTPClient instead.") alias HttpClient = HTTPClient;


/**
Represents a HTTP client request (as sent to the server).
Expand Down Expand Up @@ -503,9 +491,6 @@ final class HTTPClientRequest : HTTPRequest {
}
}

/// Deprecated compatibility alias
deprecated("Please use HTTPClientRequest instead.") alias HttpClientRequest = HTTPClientRequest;


/**
Represents a HTTP client response (as received from the server).
Expand Down Expand Up @@ -703,9 +688,6 @@ final class HTTPClientResponse : HTTPResponse {
}
}

/// Deprecated compatibility alias
deprecated("Please use HTTPClientResponse instead.") alias HttpClientResponse = HTTPClientResponse;


private __gshared NullOutputStream s_sink;

Expand Down

0 comments on commit 3c405e4

Please sign in to comment.