Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
HEP
HEPnOS
Commits
ff6aeca9
Commit
ff6aeca9
authored
Feb 04, 2021
by
Matthieu Dorier
Browse files
changed hashing function for products
parent
50184891
Changes
2
Show whitespace changes
Inline
Side-by-side
src/DataStoreImpl.hpp
View file @
ff6aeca9
...
...
@@ -260,7 +260,7 @@ class DataStoreImpl {
// hash the name to get the provider id
long
unsigned
db_idx
=
0
;
uint64_t
hash
;
hash
=
hashString
(
productID
.
m_key
);
hash
=
hashString
(
productID
.
m_key
.
c_str
(),
sizeof
(
ItemDescriptor
)
);
ch_placement_find_closest
(
m_product_dbs
.
chi
,
hash
,
1
,
&
db_idx
);
return
m_product_dbs
.
dbs
[
db_idx
];
}
...
...
@@ -386,7 +386,7 @@ class DataStoreImpl {
// hash the name to get the provider id
long
unsigned
db_idx
=
0
;
uint64_t
hash
;
hash
=
hashString
(
containerName
);
hash
=
hashString
(
containerName
.
c_str
(),
containerName
.
size
()
);
ch_placement_find_closest
(
m_dataset_dbs
.
chi
,
hash
,
1
,
&
db_idx
);
return
m_dataset_dbs
.
dbs
[
db_idx
];
}
...
...
src/StringHash.hpp
View file @
ff6aeca9
...
...
@@ -8,10 +8,11 @@
namespace
hepnos
{
inline
size_t
hashString
(
const
std
::
string
&
str
)
{
inline
size_t
hashString
(
const
char
*
str
,
size_t
size
)
{
size_t
hash
=
14695981039346656037ULL
;
size_t
prime
=
1099511628211ULL
;
for
(
const
auto
&
c
:
str
)
{
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
char
c
=
str
[
i
];
hash
=
hash
^
c
;
hash
*=
prime
;
}
...
...
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