-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* forestTest * docsgen * handle stragglers * added existing APIs already available in Forest * no more lotus build * four hodlers left * renames and reduction * merge fix * no more lotus build * four hodlers left * some * aleret wiring, fullnode alternative * goamd64 * lotus changed, so change version sig, drop v1api, etc * in-house alertinginterface * complete rm lotus/build for curio * sptool needs build, so test cannot pass * merge fixes * use specific subset of chain api * Use specific subset of chain API * unused * taskAlert * tidy * cbor thing * tidy again * gen needs tidy * fixes * tidy * avoid gen-check additions
- Loading branch information
Showing
67 changed files
with
1,879 additions
and
846 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package curioalerting | ||
|
||
import ( | ||
"sync" | ||
|
||
logging "github.com/ipfs/go-log/v2" | ||
|
||
"github.com/filecoin-project/curio/lib/paths/alertinginterface" | ||
) | ||
|
||
var log = logging.Logger("curio/alerting") | ||
|
||
type AlertingSystem struct { | ||
sync.Mutex | ||
Current map[alertinginterface.AlertType]map[string]any | ||
} | ||
|
||
func NewAlertingSystem() *AlertingSystem { | ||
return &AlertingSystem{Current: map[alertinginterface.AlertType]map[string]any{}} | ||
} | ||
|
||
func (as *AlertingSystem) AddAlertType(name, id string) alertinginterface.AlertType { | ||
return alertinginterface.AlertType{ | ||
System: id, | ||
Subsystem: name, | ||
} | ||
} | ||
|
||
func (as *AlertingSystem) Raise(alert alertinginterface.AlertType, metadata map[string]interface{}) { | ||
as.Lock() | ||
defer as.Unlock() | ||
as.Current[alert] = metadata | ||
log.Errorw("Alert raised: ", "System", alert.System, "Subsystem", alert.Subsystem, "Metadata", metadata) | ||
} | ||
|
||
func (as *AlertingSystem) IsRaised(alert alertinginterface.AlertType) bool { | ||
as.Lock() | ||
defer as.Unlock() | ||
_, ok := as.Current[alert] | ||
return ok | ||
} | ||
|
||
func (as *AlertingSystem) Resolve(alert alertinginterface.AlertType, metadata map[string]string) { | ||
as.Lock() | ||
defer as.Unlock() | ||
delete(as.Current, alert) | ||
} |
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
Oops, something went wrong.