Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ssg
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
ssg
Commits
0d329f87
Commit
0d329f87
authored
Jun 15, 2018
by
Shane Snyder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new fn for generating sparse member ids
parent
fe2b0b71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
src/ssg-internal.h
src/ssg-internal.h
+7
-0
src/ssg.c
src/ssg.c
+12
-4
No files found.
src/ssg-internal.h
View file @
0d329f87
...
...
@@ -105,6 +105,13 @@ enum ssg_group_descriptor_owner_status
#define ssg_hashlittle2 hashlittle2
extern
void
hashlittle2
(
const
void
*
key
,
size_t
length
,
uint32_t
*
pc
,
uint32_t
*
pb
);
static
inline
ssg_hash64_str
(
const
char
*
str
)
uint32_t
lower
,
upper
;
uint64_t
hash
;
ssg_hashlittle2
(
__str
,
strlen
(
__str
),
&
lower
,
&
upper
);
hash
=
lower
+
(((
uint64_t
)
upper
)
<<
32
);
return
hash
;
}
void
ssg_register_rpcs
(
void
);
...
...
src/ssg.c
View file @
0d329f87
...
...
@@ -53,6 +53,8 @@ static int ssg_group_view_create(
const
char
*
const
group_addr_strs
[],
int
group_size
,
hg_addr_t
self_addr
,
ssg_member_id_t
*
self_id
,
ssg_group_view_t
*
view
);
static
ssg_member_id_t
ssg_gen_member_id
(
const
char
*
addr_str
);
static
void
ssg_group_view_destroy
(
ssg_group_view_t
*
view
);
static
void
ssg_group_destroy_internal
(
...
...
@@ -132,7 +134,6 @@ ssg_group_id_t ssg_group_create(
ssg_membership_update_cb
update_cb
,
void
*
update_cb_dat
)
{
uint32_t
upper
,
lower
;
uint64_t
name_hash
;
hg_addr_t
self_addr
=
HG_ADDR_NULL
;
ssg_group_descriptor_t
*
tmp_descriptor
;
...
...
@@ -143,8 +144,7 @@ ssg_group_id_t ssg_group_create(
if
(
!
ssg_inst
)
return
group_id
;
ssg_hashlittle2
(
group_name
,
strlen
(
group_name
),
&
lower
,
&
upper
);
name_hash
=
lower
+
(((
uint64_t
)
upper
)
<<
32
);
name_hash
=
ssg_hash64_str
(
group_name
);
/* generate a unique ID for this group */
tmp_descriptor
=
ssg_group_descriptor_create
(
name_hash
,
group_addr_strs
[
0
],
...
...
@@ -1153,7 +1153,15 @@ fini:
static
ssg_member_id_t
ssg_gen_member_id
(
const
char
*
addr_str
)
{
return
SSG_MEMBER_ID_INVALID
;
char
tmp
[
64
]
=
{
0
};
ssg_member_id_t
id
=
(
ssg_member_id_t
)
ssg_hash64_str
(
addr_str
);
while
(
id
==
SSG_MEMBER_ID_INVALID
)
{
if
(
tmp
[
0
]
==
0
)
strncpy
(
tmp
,
addr_str
,
63
);
tmp
[
0
]
++
;
id
=
(
ssg_member_id_t
)
ssg_hash64_str
(
tmp
);
}
return
id
;
}
...
...
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