Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
c4ede544
Commit
c4ede544
authored
Dec 23, 2018
by
Clint.Network
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement Increment Iterator method
parent
2d7e3b56
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
ISettings.cs
Stratis.Guru/Models/ISettings.cs
+2
-1
Setting.cs
Stratis.Guru/Models/Setting.cs
+1
-1
Settings.cs
Stratis.Guru/Models/Settings.cs
+7
-1
No files found.
Stratis.Guru/Models/ISettings.cs
View file @
c4ede544
...
@@ -7,6 +7,7 @@ namespace Stratis.Guru.Models
...
@@ -7,6 +7,7 @@ namespace Stratis.Guru.Models
public
interface
ISettings
public
interface
ISettings
{
{
Task
InitAsync
();
Task
InitAsync
();
int
GetIterator
();
uint
GetIterator
();
void
IncrementIterator
();
}
}
}
}
\ No newline at end of file
Stratis.Guru/Models/Setting.cs
View file @
c4ede544
...
@@ -7,6 +7,6 @@ namespace Stratis.Guru.Models
...
@@ -7,6 +7,6 @@ namespace Stratis.Guru.Models
{
{
[
BsonId
]
[
BsonId
]
public
ObjectId
Id
{
get
;
set
;
}
public
ObjectId
Id
{
get
;
set
;
}
public
int
PublicKeyIterator
{
get
;
set
;
}
public
u
int
PublicKeyIterator
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Stratis.Guru/Models/Settings.cs
View file @
c4ede544
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
MongoDB.Driver
;
using
MongoDB.Driver
;
using
MongoDB.Driver.Builders
;
namespace
Stratis.Guru.Models
namespace
Stratis.Guru.Models
{
{
...
@@ -12,8 +13,13 @@ namespace Stratis.Guru.Models
...
@@ -12,8 +13,13 @@ namespace Stratis.Guru.Models
_databaseContext
=
databaseContext
;
_databaseContext
=
databaseContext
;
}
}
public
int
GetIterator
()
=>
_databaseContext
.
Settings
.
Find
(
x
=>
true
).
FirstOrDefault
().
PublicKeyIterator
;
public
u
int
GetIterator
()
=>
_databaseContext
.
Settings
.
Find
(
x
=>
true
).
FirstOrDefault
().
PublicKeyIterator
;
public
void
IncrementIterator
()
{
var
itemId
=
_databaseContext
.
Settings
.
Find
(
x
=>
true
).
FirstOrDefault
().
Id
;
_databaseContext
.
Settings
.
FindOneAndUpdate
(
Builders
<
Setting
>.
Filter
.
Eq
(
"_id"
,
itemId
),
Builders
<
Setting
>.
Update
.
Inc
(
c
=>
c
.
PublicKeyIterator
,
(
uint
)
1
),
new
FindOneAndUpdateOptions
<
Setting
>
{
IsUpsert
=
true
});
}
public
async
Task
InitAsync
()
public
async
Task
InitAsync
()
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment