diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-08-10 15:12:56 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2018-08-10 15:12:56 +0800 |
commit | 09a0ab086cdafcb27b74e6346efdc8e96ca8145d (patch) | |
tree | c14bda316a48c94e5300b5799f152a82f0594558 /core/types | |
parent | 03917cdfa1f762849541e1bed31394340ed1f957 (diff) | |
download | dexon-consensus-09a0ab086cdafcb27b74e6346efdc8e96ca8145d.tar dexon-consensus-09a0ab086cdafcb27b74e6346efdc8e96ca8145d.tar.gz dexon-consensus-09a0ab086cdafcb27b74e6346efdc8e96ca8145d.tar.bz2 dexon-consensus-09a0ab086cdafcb27b74e6346efdc8e96ca8145d.tar.lz dexon-consensus-09a0ab086cdafcb27b74e6346efdc8e96ca8145d.tar.xz dexon-consensus-09a0ab086cdafcb27b74e6346efdc8e96ca8145d.tar.zst dexon-consensus-09a0ab086cdafcb27b74e6346efdc8e96ca8145d.zip |
core: update governance interface and move K into config (#40)
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/configuration.go | 46 | ||||
-rw-r--r-- | core/types/membership-event.go | 16 |
2 files changed, 46 insertions, 16 deletions
diff --git a/core/types/configuration.go b/core/types/configuration.go new file mode 100644 index 0000000..4158331 --- /dev/null +++ b/core/types/configuration.go @@ -0,0 +1,46 @@ +// Copyright 2018 The dexon-consensus-core Authors +// This file is part of the dexon-consensus-core library. +// +// The dexon-consensus-core library is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The dexon-consensus-core library is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the dexon-consensus-core library. If not, see +// <http://www.gnu.org/licenses/>. + +package types + +// ConfigurationChangeEventType specifies the action of a membership event. +type ConfigurationChangeEventType int + +// Event enums. +const ( + KChanged ConfigurationChangeEventType = iota + MembershipAdd + MembershipRemove +) + +// IntegerEventPayload is a general payload for integer type value. +type IntegerEventPayload struct { + Value int64 +} + +// MembershipEventPayload is the payload type for membership event. +type MembershipEventPayload struct { + ID ValidatorID + Evidence []byte +} + +// ConfigurationChangeEvent specifies the event of membership changes. +type ConfigurationChangeEvent struct { + Epoch int + Event ConfigurationChangeEventType + Payload interface{} +} diff --git a/core/types/membership-event.go b/core/types/membership-event.go deleted file mode 100644 index 8d05039..0000000 --- a/core/types/membership-event.go +++ /dev/null @@ -1,16 +0,0 @@ -package types - -// MembershipActionType specifies the action of a membership event. -type MembershipActionType int - -// Event enums. -const ( - MembershipActionAdd MembershipActionType = iota - MembershipActionDelete -) - -// MembershipEvent specifies the event of membership changes. -type MembershipEvent struct { - Epoch int - Action MembershipActionType -} |