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
979b5f8d
Unverified
Commit
979b5f8d
authored
Jul 23, 2024
by
Hamdi Allam
Committed by
GitHub
Jul 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make an rpc server an into a cliapp service (#11197)
parent
6f887d51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
service.go
op-service/rpc/service.go
+45
-0
No files found.
op-service/rpc/service.go
0 → 100644
View file @
979b5f8d
package
rpc
import
(
"context"
"sync/atomic"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-service/cliapp"
)
var
_
cliapp
.
Lifecycle
=
&
Service
{}
type
Service
struct
{
log
log
.
Logger
srv
*
Server
stopped
atomic
.
Bool
}
func
NewService
(
log
log
.
Logger
,
srv
*
Server
)
*
Service
{
return
&
Service
{
log
:
log
,
srv
:
srv
,
stopped
:
atomic
.
Bool
{}}
}
func
(
s
*
Service
)
Start
(
_
context
.
Context
)
error
{
s
.
log
.
Info
(
"starting rpc server"
)
return
s
.
srv
.
Start
()
}
func
(
s
*
Service
)
Stop
(
_
context
.
Context
)
error
{
if
s
.
stopped
.
Load
()
{
return
nil
}
s
.
log
.
Info
(
"stopping rpc server"
)
err
:=
s
.
srv
.
Stop
()
if
err
==
nil
{
s
.
stopped
.
Store
(
true
)
}
return
err
}
func
(
s
*
Service
)
Stopped
()
bool
{
return
s
.
stopped
.
Load
()
}
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