forked from steemit/steem
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow exposing public_api via get_api_by_name()
This commit changes the required method signature of API class ctors. The main reason is that the mapping of names to API objects occurs at the connection level, which is an intermediate level between the level of the app and the level of the individual API. A shared_ptr reference to api_connection_context (a container for state at this intermediate level) is now passed to API ctor's along with the & reference to the application.
- Loading branch information
1 parent
59e7ea9
commit a594663
Showing
11 changed files
with
87 additions
and
36 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
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
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,35 @@ | ||
#pragma once | ||
|
||
#include <map> | ||
#include <string> | ||
#include <utility> | ||
|
||
#include <fc/api.hpp> | ||
|
||
namespace steemit { namespace app { | ||
|
||
class application; | ||
|
||
/** | ||
* Contains state shared by all API's on the same connection. | ||
*/ | ||
|
||
struct api_connection_context | ||
{ | ||
std::map< std::string, fc::api_ptr > api_map; | ||
}; | ||
|
||
/** | ||
* Contains information needed by API class constructors. | ||
*/ | ||
|
||
struct api_context | ||
{ | ||
api_context( application& _app, const std::string& _api_name, std::weak_ptr< api_connection_context > _connection ); | ||
|
||
application& app; | ||
std::string api_name; | ||
std::shared_ptr< api_connection_context > connection; | ||
}; | ||
|
||
} } |
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
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
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