github.com/braveheart12/just@v0.8.7/core/message/heavy.go (about)

     1  /*
     2   *    Copyright 2019 Insolar Technologies
     3   *
     4   *    Licensed under the Apache License, Version 2.0 (the "License");
     5   *    you may not use this file except in compliance with the License.
     6   *    You may obtain a copy of the License at
     7   *
     8   *        http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   *    Unless required by applicable law or agreed to in writing, software
    11   *    distributed under the License is distributed on an "AS IS" BASIS,
    12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   *    See the License for the specific language governing permissions and
    14   *    limitations under the License.
    15   */
    16  
    17  package message
    18  
    19  import (
    20  	"github.com/insolar/insolar/core"
    21  )
    22  
    23  // HeavyPayload carries Key/Value records and pulse number
    24  // that replicates to Heavy Material node.
    25  type HeavyPayload struct {
    26  	JetID    core.RecordID
    27  	PulseNum core.PulseNumber
    28  	Records  []core.KV
    29  }
    30  
    31  // AllowedSenderObjectAndRole implements interface method
    32  func (*HeavyPayload) AllowedSenderObjectAndRole() (*core.RecordRef, core.DynamicRole) {
    33  	return nil, 0
    34  }
    35  
    36  // DefaultRole returns role for this event
    37  func (*HeavyPayload) DefaultRole() core.DynamicRole {
    38  	return core.DynamicRoleHeavyExecutor
    39  }
    40  
    41  // DefaultTarget returns of target of this event.
    42  func (hp *HeavyPayload) DefaultTarget() *core.RecordRef {
    43  	return &core.RecordRef{}
    44  }
    45  
    46  // GetCaller implementation of Message interface.
    47  func (HeavyPayload) GetCaller() *core.RecordRef {
    48  	return nil
    49  }
    50  
    51  // Type implementation of Message interface.
    52  func (hp *HeavyPayload) Type() core.MessageType {
    53  	return core.TypeHeavyPayload
    54  }
    55  
    56  // HeavyStartStop carries heavy replication start/stop signal with pulse number.
    57  type HeavyStartStop struct {
    58  	JetID    core.RecordID
    59  	PulseNum core.PulseNumber
    60  	Finished bool
    61  }
    62  
    63  // AllowedSenderObjectAndRole implements interface method
    64  func (*HeavyStartStop) AllowedSenderObjectAndRole() (*core.RecordRef, core.DynamicRole) {
    65  	return nil, 0
    66  }
    67  
    68  // DefaultTarget returns of target of this event.
    69  func (*HeavyStartStop) DefaultTarget() *core.RecordRef {
    70  	return &core.RecordRef{}
    71  }
    72  
    73  // DefaultRole returns role for this event
    74  func (*HeavyStartStop) DefaultRole() core.DynamicRole {
    75  	return core.DynamicRoleHeavyExecutor
    76  }
    77  
    78  // GetCaller implementation of Message interface.
    79  func (HeavyStartStop) GetCaller() *core.RecordRef {
    80  	return nil
    81  }
    82  
    83  // Type implementation of Message interface.
    84  func (e *HeavyStartStop) Type() core.MessageType {
    85  	return core.TypeHeavyStartStop
    86  }
    87  
    88  // HeavyReset carries heavy replication start/stop signal with pulse number.
    89  type HeavyReset struct {
    90  	JetID    core.RecordID
    91  	PulseNum core.PulseNumber
    92  }
    93  
    94  // AllowedSenderObjectAndRole implements interface method
    95  func (*HeavyReset) AllowedSenderObjectAndRole() (*core.RecordRef, core.DynamicRole) {
    96  	return nil, 0
    97  }
    98  
    99  // DefaultTarget returns of target of this event.
   100  func (*HeavyReset) DefaultTarget() *core.RecordRef {
   101  	return &core.RecordRef{}
   102  }
   103  
   104  // DefaultRole returns role for this event
   105  func (*HeavyReset) DefaultRole() core.DynamicRole {
   106  	return core.DynamicRoleHeavyExecutor
   107  }
   108  
   109  // GetCaller implementation of Message interface.
   110  func (HeavyReset) GetCaller() *core.RecordRef {
   111  	return nil
   112  }
   113  
   114  // Type implementation of Message interface.
   115  func (e *HeavyReset) Type() core.MessageType {
   116  	return core.TypeHeavyReset
   117  }