status-im/status-go

View on GitHub
services/rpcstats/service.go

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package rpcstats

import (
    "github.com/ethereum/go-ethereum/p2p"
    "github.com/ethereum/go-ethereum/rpc"
)

// Service represents our own implementation of status status operations.
type Service struct{}

// New returns a new Service.
func New() *Service {
    return &Service{}
}

// APIs returns a list of new APIs.
func (s *Service) APIs() []rpc.API {
    return []rpc.API{
        {
            Namespace: "rpcstats",
            Version:   "1.0",
            Service:   NewAPI(s),
            Public:    true,
        },
    }
}

// Protocols returns list of p2p protocols.
func (s *Service) Protocols() []p2p.Protocol {
    return nil
}

// Start is run when a service is started.
// It does nothing in this case but is required by `node.Service` interface.
func (s *Service) Start() error {
    resetStats()
    return nil
}

// Stop is run when a service is stopped.
// It does nothing in this case but is required by `node.Service` interface.
func (s *Service) Stop() error {
    return nil
}