Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
6f54bfd2
Unverified
Commit
6f54bfd2
authored
Oct 31, 2022
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: driver loop / sync status doc comments
parent
12526f31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
state.go
op-node/rollup/driver/state.go
+8
-1
No files found.
op-node/rollup/driver/state.go
View file @
6f54bfd2
...
...
@@ -30,7 +30,7 @@ type Driver struct {
// When the derivation pipeline is waiting for new data to do anything
idleDerivation
bool
// Requests
for synchronized event loop
execution to avoid reading an inconsistent state
// Requests
to block the event loop for synchronous
execution to avoid reading an inconsistent state
stateReq
chan
chan
struct
{}
// Upon receiving a channel in this channel, the derivation pipeline is forced to be reset.
...
...
@@ -373,6 +373,8 @@ func (s *Driver) ResetDerivationPipeline(ctx context.Context) error {
}
}
// syncStatus returns the current sync status, and should only be called synchronously with
// the driver event loop to avoid retrieval of an inconsistent status.
func
(
s
*
Driver
)
syncStatus
()
*
eth
.
SyncStatus
{
return
&
eth
.
SyncStatus
{
CurrentL1
:
s
.
derivation
.
Origin
(),
...
...
@@ -386,6 +388,8 @@ func (s *Driver) syncStatus() *eth.SyncStatus {
}
}
// SyncStatus blocks the driver event loop and captures the syncing status.
// If the event loop is too busy and the context expires, a context error is returned.
func
(
s
*
Driver
)
SyncStatus
(
ctx
context
.
Context
)
(
*
eth
.
SyncStatus
,
error
)
{
wait
:=
make
(
chan
struct
{})
select
{
...
...
@@ -398,6 +402,9 @@ func (s *Driver) SyncStatus(ctx context.Context) (*eth.SyncStatus, error) {
}
}
// BlockRefWithStatus blocks the driver event loop and captures the syncing status,
// along with an L2 block reference by number consistent with that same status.
// If the event loop is too busy and the context expires, a context error is returned.
func
(
s
*
Driver
)
BlockRefWithStatus
(
ctx
context
.
Context
,
num
uint64
)
(
eth
.
L2BlockRef
,
*
eth
.
SyncStatus
,
error
)
{
wait
:=
make
(
chan
struct
{})
select
{
...
...
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