You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
758 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. package types
  2. type Application interface {
  3. // For new socket connections
  4. Open() AppContext
  5. }
  6. type AppContext interface {
  7. // Echo a message
  8. Echo(message string) string
  9. // Return application info
  10. Info() []string
  11. // Set application option (e.g. mode=mempool, mode=consensus)
  12. SetOption(key string, value string) RetCode
  13. // Append a tx, which may or may not get committed
  14. AppendTx(tx []byte) ([]Event, RetCode)
  15. // Return the application Merkle root hash
  16. GetHash() ([]byte, RetCode)
  17. // Set commit checkpoint
  18. Commit() RetCode
  19. // Rollback to the latest commit
  20. Rollback() RetCode
  21. // Add event listener
  22. AddListener(key string) RetCode
  23. // Remove event listener
  24. RemListener(key string) RetCode
  25. // Close this AppContext
  26. Close() error
  27. }