FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
StockSharp/Algo/ExtendedInfoStorageMessageAdapter.cs at master · StockSharp/StockSharp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
StockSharp
/
StockSharp
Public
Notifications
You must be signed in to change notification settings
Fork
2.3k
Star
10.7k
Code
Issues
1
Pull requests
1
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
StockSharp
/
Algo
/
ExtendedInfoStorageMessageAdapter.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (51 loc) · 2.07 KB
Breadcrumbs
StockSharp
/
Algo
/
ExtendedInfoStorageMessageAdapter.cs
Copy path
File metadata and controls
60 lines (51 loc) · 2.07 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
namespace
StockSharp
.
Algo
;
/// <summary>
/// The message adapter, that save extension info into <see cref="IExtendedInfoStorage"/>.
/// </summary>
public
class
ExtendedInfoStorageMessageAdapter
:
MessageAdapterWrapper
{
private
readonly
IExtendedInfoStorage
_extendedInfoStorage
;
private
readonly
string
_storageName
;
private
readonly
IEnumerable
<
(
string
,
Type
)
>
_fields
;
private
readonly
AsyncLock
_sync
=
new
(
)
;
private
IExtendedInfoStorageItem
_storage
;
/// <summary>
/// Initializes a new instance of the <see cref="MessageAdapterWrapper"/>.
/// </summary>
/// <param name="innerAdapter">Underlying adapter.</param>
/// <param name="extendedInfoStorage">Extended info storage.</param>
public
ExtendedInfoStorageMessageAdapter
(
IMessageAdapter
innerAdapter
,
IExtendedInfoStorage
extendedInfoStorage
)
:
base
(
innerAdapter
)
{
if
(
InnerAdapter
.
StorageName
.
IsEmpty
(
)
)
throw
new
ArgumentException
(
nameof
(
innerAdapter
)
)
;
_extendedInfoStorage
=
extendedInfoStorage
??
throw
new
ArgumentNullException
(
nameof
(
extendedInfoStorage
)
)
;
_storageName
=
InnerAdapter
.
StorageName
;
_fields
=
[
..
InnerAdapter
.
SecurityExtendedFields
]
;
}
private
async
ValueTask
<
IExtendedInfoStorageItem
>
GetStorageAsync
(
CancellationToken
cancellationToken
)
{
if
(
_storage
==
null
)
{
using
(
await
_sync
.
LockAsync
(
cancellationToken
)
)
_storage
??=
await
_extendedInfoStorage
.
CreateAsync
(
_storageName
,
_fields
,
cancellationToken
)
;
}
return
_storage
;
}
/// <inheritdoc />
protected
override
async
ValueTask
OnInnerAdapterNewOutMessageAsync
(
Message
message
,
CancellationToken
cancellationToken
)
{
var
secMsg
=
message
as
SecurityMessage
;
//if (secMsg?.ExtensionInfo != null)
// GetStorageAsync().Add(secMsg.SecurityId, secMsg.ExtensionInfo);
await
base
.
OnInnerAdapterNewOutMessageAsync
(
message
,
cancellationToken
)
;
}
/// <summary>
/// Create a copy of <see cref="ExtendedInfoStorageMessageAdapter"/>.
/// </summary>
/// <returns>Copy.</returns>
public
override
IMessageAdapter
Clone
(
)
{
return
new
ExtendedInfoStorageMessageAdapter
(
InnerAdapter
.
TypedClone
(
)
,
_extendedInfoStorage
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL