Documentation ¶
Index ¶
- Variables
- func UnmarshalConfig(data []byte) (*cb.Config, error)
- func UnmarshalConfigEnvelope(data []byte) (*cb.ConfigEnvelope, error)
- func UnmarshalConfigEnvelopeOrPanic(data []byte) *cb.ConfigEnvelope
- func UnmarshalConfigOrPanic(data []byte) *cb.Config
- func UnmarshalConfigUpdate(data []byte) (*cb.ConfigUpdate, error)
- func UnmarshalConfigUpdateEnvelope(data []byte) (*cb.ConfigUpdateEnvelope, error)
- func UnmarshalConfigUpdateEnvelopeOrPanic(data []byte) *cb.ConfigUpdateEnvelope
- func UnmarshalConfigUpdateFromPayload(payload *cb.Payload) (*cb.ConfigUpdate, error)
- func UnmarshalConfigUpdateOrPanic(data []byte) *cb.ConfigUpdate
- func ValidateChannelID(channelID string) error
- type Validator
- type ValidatorImpl
- func (vi *ValidatorImpl) ChannelID() string
- func (vi *ValidatorImpl) ConfigProto() *cb.Config
- func (vi *ValidatorImpl) ProposeConfigUpdate(configtx *cb.Envelope) (*cb.ConfigEnvelope, error)
- func (vi *ValidatorImpl) Sequence() uint64
- func (vi *ValidatorImpl) Validate(configEnv *cb.ConfigEnvelope) error
Constants ¶
This section is empty.
Variables ¶
var ( ChannelAllowedChars = "[a-z][a-z0-9.-]*" MaxLength = 249 )
Constraints for valid channel and config IDs
Functions ¶
func UnmarshalConfig ¶
UnmarshalConfig attempts to unmarshal bytes to a *cb.Config
func UnmarshalConfigEnvelope ¶
func UnmarshalConfigEnvelope(data []byte) (*cb.ConfigEnvelope, error)
UnmarshalConfigEnvelope attempts to unmarshal bytes to a *cb.ConfigEnvelope
func UnmarshalConfigEnvelopeOrPanic ¶
func UnmarshalConfigEnvelopeOrPanic(data []byte) *cb.ConfigEnvelope
UnmarshalConfigEnvelopeOrPanic attempts to unmarshal bytes to a *cb.ConfigEnvelope or panics on error
func UnmarshalConfigOrPanic ¶
UnmarshalConfigOrPanic attempts to unmarshal bytes to a *cb.Config or panics on error
func UnmarshalConfigUpdate ¶
func UnmarshalConfigUpdate(data []byte) (*cb.ConfigUpdate, error)
UnmarshalConfigUpdate attempts to unmarshal bytes to a *cb.ConfigUpdate
func UnmarshalConfigUpdateEnvelope ¶
func UnmarshalConfigUpdateEnvelope(data []byte) (*cb.ConfigUpdateEnvelope, error)
UnmarshalConfigUpdateEnvelope attempts to unmarshal bytes to a *cb.ConfigUpdate
func UnmarshalConfigUpdateEnvelopeOrPanic ¶
func UnmarshalConfigUpdateEnvelopeOrPanic(data []byte) *cb.ConfigUpdateEnvelope
UnmarshalConfigUpdateEnvelopeOrPanic attempts to unmarshal bytes to a *cb.ConfigUpdateEnvelope or panics on error
func UnmarshalConfigUpdateFromPayload ¶ added in v1.4.1
func UnmarshalConfigUpdateFromPayload(payload *cb.Payload) (*cb.ConfigUpdate, error)
UnmarshalConfigUpdateFromPayload unmarshals configuration update from given payload
func UnmarshalConfigUpdateOrPanic ¶
func UnmarshalConfigUpdateOrPanic(data []byte) *cb.ConfigUpdate
UnmarshalConfigUpdateOrPanic attempts to unmarshal bytes to a *cb.ConfigUpdate or panics on error
func ValidateChannelID ¶
ValidateChannelID makes sure that proposed channel IDs comply with the following restrictions:
- Contain only lower case ASCII alphanumerics, dots '.', and dashes '-'
- Are shorter than 250 characters.
- Start with a letter
This is the intersection of the Kafka restrictions and CouchDB restrictions with the following exception: '.' is converted to '_' in the CouchDB naming This is to accommodate existing channel names with '.', especially in the behave tests which rely on the dot notation for their sluggification.
note: this function is a copy of the same in core/tx/endorser/parser.go
Types ¶
type Validator ¶ added in v1.1.1
type Validator interface { // Validate attempts to apply a configtx to become the new config Validate(configEnv *cb.ConfigEnvelope) error // Validate attempts to validate a new configtx against the current config state ProposeConfigUpdate(configtx *cb.Envelope) (*cb.ConfigEnvelope, error) // ChannelID retrieves the channel ID associated with this manager ChannelID() string // ConfigProto returns the current config as a proto ConfigProto() *cb.Config // Sequence returns the current sequence number of the config Sequence() uint64 }
Validator provides a mechanism to propose config updates, see the config update results and validate the results of a config update.
type ValidatorImpl ¶ added in v1.1.1
type ValidatorImpl struct {
// contains filtered or unexported fields
}
ValidatorImpl implements the Validator interface
func NewValidatorImpl ¶ added in v1.1.1
func NewValidatorImpl(channelID string, config *cb.Config, namespace string, pm policies.Manager) (*ValidatorImpl, error)
NewValidatorImpl constructs a new implementation of the Validator interface.
func (*ValidatorImpl) ChannelID ¶
func (vi *ValidatorImpl) ChannelID() string
ChannelID retrieves the channel ID associated with this manager
func (*ValidatorImpl) ConfigProto ¶ added in v1.1.1
func (vi *ValidatorImpl) ConfigProto() *cb.Config
ConfigProto returns the config proto which initialized this Validator
func (*ValidatorImpl) ProposeConfigUpdate ¶ added in v1.1.1
func (vi *ValidatorImpl) ProposeConfigUpdate(configtx *cb.Envelope) (*cb.ConfigEnvelope, error)
ProposeConfigUpdate takes in an Envelope of type CONFIG_UPDATE and produces a ConfigEnvelope to be used as the Envelope Payload Data of a CONFIG message
func (*ValidatorImpl) Sequence ¶ added in v1.1.1
func (vi *ValidatorImpl) Sequence() uint64
Sequence returns the sequence number of the config
func (*ValidatorImpl) Validate ¶ added in v1.1.1
func (vi *ValidatorImpl) Validate(configEnv *cb.ConfigEnvelope) error
Validate simulates applying a ConfigEnvelope to become the new config