Skip to content

Commit

Permalink
Basic scaffolding for CDK
Browse files Browse the repository at this point in the history
  • Loading branch information
vcastellm committed May 29, 2024
1 parent 879e76e commit 0f51143
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 0 deletions.
Empty file added api/.gitkeep
Empty file.
Empty file added build/docker-compose.yml
Empty file.
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package main
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/0xPolygon/cdk

go 1.22
Empty file added go.sum
Empty file.
Empty file added internal/.gitkeep
Empty file.
Empty file added pkg/aggregatormanager/.gitkeep
Empty file.
Empty file.
Empty file added pkg/dataavailability/.gitkeep
Empty file.
Empty file added pkg/rpcproxy/.gitkeep
Empty file.
Empty file added pkg/sequencesender/.gitkeep
Empty file.
Empty file added pkg/syncer/.gitkeep
Empty file.
Empty file added scripts/.gitkeep
Empty file.
Empty file added sequencermanager/.gitkeep
Empty file.
Empty file added sequencesender/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions syncer/ethprovider/ethprovider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ethsyncer

import (
"github.com/0xPolygon/cdk/syncer/storage"
)

type EthSyncer struct {
Storage storage.StorageService
}
9 changes: 9 additions & 0 deletions syncer/interfaces.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package syncer

type EventSyncer interface {
GetData() []byte
}

type EventProcessor interface {
Process(data []byte) error
}
1 change: 1 addition & 0 deletions syncer/provider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package syncer
8 changes: 8 additions & 0 deletions syncer/storage/inmem/inmem.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package inmem

type Inmem struct {
}

func (inmem *Inmem) GetData() []byte {
return []byte("Inmem")
}
7 changes: 7 additions & 0 deletions syncer/storage/storage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package storage

// Storage is an interface for the storage of the syncer
type StorageService interface {
GetData() []byte
GetLatestVerifiedBlock() uint64
}
23 changes: 23 additions & 0 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package syncer

type Syncer interface {
// Start starts the syncer
Start() error
// Stop stops the syncer
Stop() error
// Synced returns true if the syncer is synced
Synced() bool
// SyncedChan returns a channel that is closed when the syncer is synced
SyncedChan() <-chan struct{}
// LatestVerifiedBlock returns the latest verified block
LatestVerifiedBlock() uint64
// LatestBlock returns the latest block
LatestBlock() uint64
// SyncedBlock returns the latest block that is synced
SyncedBlock() uint64
// SyncedBlockChan returns a channel that is closed when the latest block is synced
SyncedBlockChan() <-chan struct{}
}

type Sync struct {
}
1 change: 1 addition & 0 deletions test/e2e.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package e2e

0 comments on commit 0f51143

Please sign in to comment.