-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
141 additions
and
86 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
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 |
---|---|---|
@@ -1,9 +1,68 @@ | ||
package constants | ||
|
||
// TODO: consider turning these into enums | ||
import "errors" | ||
|
||
var ( | ||
ErrInvalidMode = errors.New("invalid rosetta mode") | ||
ErrInvalidIngestionMode = errors.New("invalid rosetta ingestion mode") | ||
) | ||
|
||
type NodeMode uint8 | ||
|
||
const ( | ||
Unknown NodeMode = iota + 1 | ||
Offline | ||
Online | ||
) | ||
|
||
func (m NodeMode) String() string { | ||
switch m { | ||
case Offline: | ||
return "offline" | ||
case Online: | ||
return "online" | ||
default: | ||
return "unknown" | ||
} | ||
} | ||
|
||
func GetNodeMode(s string) (NodeMode, error) { | ||
switch { | ||
case s == "offline": | ||
return Offline, nil | ||
case s == "online": | ||
return Online, nil | ||
default: | ||
return Unknown, ErrInvalidMode | ||
} | ||
} | ||
|
||
type NodeIngestion uint8 | ||
|
||
const ( | ||
ModeOffline = "offline" | ||
ModeOnline = "online" | ||
StandardIngestion = "standard" | ||
AnalyticsIngestion = "analytics" | ||
UnknownIngestion NodeIngestion = iota + 1 | ||
StandardIngestion | ||
AnalyticsIngestion | ||
) | ||
|
||
func (m NodeIngestion) String() string { | ||
switch m { | ||
case StandardIngestion: | ||
return "standard" | ||
case AnalyticsIngestion: | ||
return "analytics" | ||
default: | ||
return "unknown" | ||
} | ||
} | ||
|
||
func GetNodeIngestion(s string) (NodeIngestion, error) { | ||
switch { | ||
case s == "standard": | ||
return StandardIngestion, nil | ||
case s == "analytics": | ||
return AnalyticsIngestion, nil | ||
default: | ||
return UnknownIngestion, ErrInvalidIngestionMode | ||
} | ||
} |
Oops, something went wrong.