Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
446da4b7
Commit
446da4b7
authored
2 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
value: use move in where
parent
aa958b0f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendht/value.h
+14
-11
14 additions, 11 deletions
include/opendht/value.h
src/securedht.cpp
+2
-2
2 additions, 2 deletions
src/securedht.cpp
with
16 additions
and
13 deletions
include/opendht/value.h
+
14
−
11
View file @
446da4b7
...
...
@@ -804,11 +804,11 @@ struct OPENDHT_PUBLIC Where
*
* @return the resulting Where instance.
*/
Where
&
id
(
Value
::
Id
id
)
{
Where
&
&
id
(
Value
::
Id
id
)
{
FieldValue
fv
{
Value
::
Field
::
Id
,
id
};
if
(
std
::
find
(
filters_
.
begin
(),
filters_
.
end
(),
fv
)
==
filters_
.
end
())
filters_
.
emplace_back
(
std
::
move
(
fv
));
return
*
this
;
return
std
::
move
(
*
this
)
;
}
/**
...
...
@@ -818,11 +818,11 @@ struct OPENDHT_PUBLIC Where
*
* @return the resulting Where instance.
*/
Where
&
valueType
(
ValueType
::
Id
type
)
{
Where
&
&
valueType
(
ValueType
::
Id
type
)
{
FieldValue
fv
{
Value
::
Field
::
ValueType
,
type
};
if
(
std
::
find
(
filters_
.
begin
(),
filters_
.
end
(),
fv
)
==
filters_
.
end
())
filters_
.
emplace_back
(
std
::
move
(
fv
));
return
*
this
;
return
std
::
move
(
*
this
)
;
}
/**
...
...
@@ -832,11 +832,11 @@ struct OPENDHT_PUBLIC Where
*
* @return the resulting Where instance.
*/
Where
&
owner
(
InfoHash
owner_pk_hash
)
{
Where
&
&
owner
(
InfoHash
owner_pk_hash
)
{
FieldValue
fv
{
Value
::
Field
::
OwnerPk
,
owner_pk_hash
};
if
(
std
::
find
(
filters_
.
begin
(),
filters_
.
end
(),
fv
)
==
filters_
.
end
())
filters_
.
emplace_back
(
std
::
move
(
fv
));
return
*
this
;
return
std
::
move
(
*
this
)
;
}
/**
...
...
@@ -846,11 +846,11 @@ struct OPENDHT_PUBLIC Where
*
* @return the resulting Where instance.
*/
Where
&
seq
(
uint16_t
seq_no
)
{
Where
&
&
seq
(
uint16_t
seq_no
)
{
FieldValue
fv
{
Value
::
Field
::
SeqNum
,
seq_no
};
if
(
std
::
find
(
filters_
.
begin
(),
filters_
.
end
(),
fv
)
==
filters_
.
end
())
filters_
.
emplace_back
(
std
::
move
(
fv
));
return
*
this
;
return
std
::
move
(
*
this
)
;
}
/**
...
...
@@ -860,11 +860,11 @@ struct OPENDHT_PUBLIC Where
*
* @return the resulting Where instance.
*/
Where
&
userType
(
std
::
string_view
user_type
)
{
Where
&
&
userType
(
std
::
string_view
user_type
)
{
FieldValue
fv
{
Value
::
Field
::
UserType
,
Blob
{
user_type
.
begin
(),
user_type
.
end
()}};
if
(
std
::
find
(
filters_
.
begin
(),
filters_
.
end
(),
fv
)
==
filters_
.
end
())
filters_
.
emplace_back
(
std
::
move
(
fv
));
return
*
this
;
return
std
::
move
(
*
this
)
;
}
/**
...
...
@@ -873,7 +873,10 @@ struct OPENDHT_PUBLIC Where
* @return the resulting Value::Filter.
*/
Value
::
Filter
getFilter
()
const
{
if
(
filters_
.
empty
())
return
{};
if
(
filters_
.
empty
())
return
{};
if
(
filters_
.
size
()
==
1
)
return
filters_
[
0
].
getLocalFilter
();
std
::
vector
<
Value
::
Filter
>
fset
;
fset
.
reserve
(
filters_
.
size
());
for
(
const
auto
&
f
:
filters_
)
{
...
...
This diff is collapsed.
Click to expand it.
src/securedht.cpp
+
2
−
2
View file @
446da4b7
...
...
@@ -326,7 +326,7 @@ SecureDht::listen(const InfoHash& id, GetCallback cb, Value::Filter f, Where w)
void
SecureDht
::
putSigned
(
const
InfoHash
&
hash
,
Sp
<
Value
>
val
,
DoneCallback
callback
,
bool
permanent
)
{
if
(
not
key_
)
{
if
(
not
key_
or
not
hash
or
not
val
)
{
if
(
callback
)
callback
(
false
,
{});
return
;
...
...
@@ -365,7 +365,7 @@ SecureDht::putSigned(const InfoHash& hash, Sp<Value> val, DoneCallback callback,
dht_
->
put
(
hash
,
val
,
callback
,
time_point
::
max
(),
permanent
);
},
Value
::
IdFilter
(
val
->
id
),
std
::
move
(
Where
().
id
(
val
->
id
)
)
Where
().
id
(
val
->
id
)
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment