MCPcopy
hub / github.com/lindb/lindb / WriteLog

Method WriteLog

replica/partition.go:226–240  ·  view source on GitHub ↗

WriteLog writes msg that leader sends replica msg.

(msg []byte)

Source from the content-addressed store, hash-verified

224
225// WriteLog writes msg that leader sends replica msg.
226func (p *partition) WriteLog(msg []byte) error {
227 if p.closed.Load() {
228 return constants.ErrPartitionClosed
229 }
230 if len(msg) == 0 {
231 return nil
232 }
233 p.statistics.ReceiveWriteSize.Add(float64(len(msg)))
234 if err := p.log.Queue().Put(msg); err != nil {
235 p.statistics.WriteWALFailures.Incr()
236 return err
237 }
238 p.statistics.WriteWAL.Incr()
239 return nil
240}
241
242// BuildReplicaForLeader builds replica relation when handle writeTask connection.
243// local replicator: replica node == current node.

Callers 1

Calls 5

LoadMethod · 0.65
AddMethod · 0.65
PutMethod · 0.65
QueueMethod · 0.65
IncrMethod · 0.45

Tested by 1