Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Julian Dehm
briar
Commits
36b191e9
Verified
Commit
36b191e9
authored
6 years ago
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Use remote states to update local states at startup.
parent
ebaa50b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bramble-core/src/main/java/org/briarproject/bramble/versioning/ClientVersioningManagerImpl.java
+8
-5
8 additions, 5 deletions
...oject/bramble/versioning/ClientVersioningManagerImpl.java
with
8 additions
and
5 deletions
bramble-core/src/main/java/org/briarproject/bramble/versioning/ClientVersioningManagerImpl.java
+
8
−
5
View file @
36b191e9
...
...
@@ -305,9 +305,15 @@ class ClientVersioningManagerImpl implements ClientVersioningManager, Client,
Update
oldLocalUpdate
=
loadUpdate
(
txn
,
latest
.
local
.
messageId
);
List
<
ClientState
>
oldLocalStates
=
oldLocalUpdate
.
states
;
long
oldLocalUpdateVersion
=
oldLocalUpdate
.
updateVersion
;
// Load and parse the latest remote update, if any
List
<
ClientState
>
remoteStates
;
if
(
latest
.
remote
==
null
)
remoteStates
=
emptyList
();
else
remoteStates
=
loadUpdate
(
txn
,
latest
.
remote
.
messageId
).
states
;
// Update the local states if necessary
List
<
ClientState
>
newLocalStates
=
updateStatesFromLocalVersions
(
oldLocalStates
,
versions
);
newLocalStates
=
updateStatesFromRemoteStates
(
newLocalStates
,
remoteStates
);
if
(!
oldLocalStates
.
equals
(
newLocalStates
))
{
// Delete the latest local update
db
.
deleteMessage
(
txn
,
latest
.
local
.
messageId
);
...
...
@@ -316,10 +322,6 @@ class ClientVersioningManagerImpl implements ClientVersioningManager, Client,
storeUpdate
(
txn
,
g
.
getId
(),
newLocalStates
,
oldLocalUpdateVersion
+
1
);
}
// Load and parse the latest remote update, if any
List
<
ClientState
>
remoteStates
;
if
(
latest
.
remote
==
null
)
remoteStates
=
emptyList
();
else
remoteStates
=
loadUpdate
(
txn
,
latest
.
remote
.
messageId
).
states
;
// Calculate the old and new client visibilities
Map
<
ClientMajorVersion
,
Visibility
>
before
=
getVisibilities
(
oldLocalStates
,
remoteStates
);
...
...
@@ -442,7 +444,8 @@ class ClientVersioningManagerImpl implements ClientVersioningManager, Client,
for
(
ClientState
local
:
localStates
)
{
ClientState
remote
=
remoteMap
.
get
(
local
.
majorVersion
);
if
(
remote
==
null
)
visibilities
.
put
(
local
.
majorVersion
,
INVISIBLE
);
else
if
(
remote
.
active
)
visibilities
.
put
(
local
.
majorVersion
,
SHARED
);
else
if
(
remote
.
active
)
visibilities
.
put
(
local
.
majorVersion
,
SHARED
);
else
visibilities
.
put
(
local
.
majorVersion
,
VISIBLE
);
}
return
visibilities
;
...
...
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