types cleanup
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 28s
Build and Publish / BuildAndDeploy (push) Successful in 2m22s

This commit is contained in:
matst80
2024-11-12 18:17:43 +01:00
parent 3f8cdec9af
commit 7e0f070637
11 changed files with 75 additions and 73 deletions

View File

@@ -61,11 +61,11 @@ var (
})
)
func (p *SyncedPool) PongHandler(data []byte) (uint32, []byte, error) {
func (p *SyncedPool) PongHandler(data []byte) (PoolMessage, []byte, error) {
return Pong, data, nil
}
func (p *SyncedPool) GetCartIdHandler(data []byte) (uint32, []byte, error) {
func (p *SyncedPool) GetCartIdHandler(data []byte) (PoolMessage, []byte, error) {
ids := make([]string, 0, len(p.local.grains))
for id := range p.local.grains {
if p.local.grains[id] == nil {
@@ -81,7 +81,7 @@ func (p *SyncedPool) GetCartIdHandler(data []byte) (uint32, []byte, error) {
return CartIdsResponse, []byte(strings.Join(ids, ";")), nil
}
func (p *SyncedPool) NegotiateHandler(data []byte) (uint32, []byte, error) {
func (p *SyncedPool) NegotiateHandler(data []byte) (PoolMessage, []byte, error) {
negotiationCount.Inc()
log.Printf("Handling negotiation\n")
for _, host := range p.ExcludeKnown(strings.Split(string(data), ";")) {
@@ -95,7 +95,7 @@ func (p *SyncedPool) NegotiateHandler(data []byte) (uint32, []byte, error) {
return RemoteNegotiateResponse, []byte("ok"), nil
}
func (p *SyncedPool) GrainOwnerChangeHandler(data []byte) (uint32, []byte, error) {
func (p *SyncedPool) GrainOwnerChangeHandler(data []byte) (PoolMessage, []byte, error) {
grainSyncCount.Inc()
idAndHostParts := strings.Split(string(data), ";")
@@ -276,16 +276,18 @@ func (p *SyncedPool) RemoveHostMappedCarts(host *RemoteHost) {
}
}
type PoolMessage uint32
const (
RemoteNegotiate = uint32(3)
RemoteGrainChanged = uint32(4)
AckChange = uint32(5)
//AckError = uint32(6)
Ping = uint32(7)
Pong = uint32(8)
GetCartIds = uint32(9)
CartIdsResponse = uint32(10)
RemoteNegotiateResponse = uint32(11)
RemoteNegotiate = PoolMessage(3)
RemoteGrainChanged = PoolMessage(4)
AckChange = PoolMessage(5)
//AckError = PoolMessage(6)
Ping = PoolMessage(7)
Pong = PoolMessage(8)
GetCartIds = PoolMessage(9)
CartIdsResponse = PoolMessage(10)
RemoteNegotiateResponse = PoolMessage(11)
)
func (p *SyncedPool) Negotiate() {