Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShallCache ¶
ShallCache tells whether a block with a given ID shall be cached or not
Types ¶
type BlockCache ¶
type BlockCache struct {
// contains filtered or unexported fields
}
BlockCache stores blocks in a map ordered by BlockID in the LRU-style
func NewBlockCache ¶
func NewBlockCache(capacity uint32) *BlockCache
NewBlockCache creates and initializes a new cache with a given capacity
func (*BlockCache) Get ¶
func (cache *BlockCache) Get(blockID BlockID) (string, error)
Get returns cached block or an error otherwise
func (*BlockCache) PutOrUpdate ¶
func (cache *BlockCache) PutOrUpdate(blockID BlockID, block string)
PutOrUpdate caches a block or just updates its lastUsed property
type ProxyServer ¶
type ProxyServer struct {
// contains filtered or unexported fields
}
ProxyServer fetches and caches Ethereum blocks
func NewProxyServer ¶
func NewProxyServer(gatewayURL string, blockCache *BlockCache) *ProxyServer
NewProxyServer creates and initializes a new proxy server using provided gateway URL and block cache
func (*ProxyServer) ServeHTTP ¶
func (ps *ProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.