-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also refactor SQS publishing to allow messages to carry the associated block height and time. Closes: #242
- Loading branch information
1 parent
b6974d3
commit 24feec8
Showing
8 changed files
with
51 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package types | ||
|
||
import "time" | ||
|
||
type BlockContext struct { | ||
Height int64 | ||
Time time.Time | ||
} | ||
|
||
func NewBlockContext(height int64, timestamp time.Time) *BlockContext { | ||
return &BlockContext{ | ||
Height: height, | ||
Time: timestamp, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
package types | ||
|
||
type Message struct { | ||
Type string `json:"type"` | ||
Data interface{} `json:"data"` | ||
Block *BlockContext `json:"-"` | ||
Type string `json:"type"` | ||
Data interface{} `json:"data"` | ||
} | ||
|
||
func NewMessage(messageType string, data interface{}) *Message { | ||
func NewMessage(messageType string, data interface{}, block *BlockContext) *Message { | ||
return &Message{ | ||
Type: messageType, | ||
Data: data, | ||
Block: block, | ||
Type: messageType, | ||
Data: data, | ||
} | ||
} |