mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
shortcut for appending operations
This commit is contained in:
parent
b5917bf846
commit
f5ee19e0db
|
@ -129,6 +129,15 @@ func (c *ContinuousIntervals) AddInterval(data []byte, offset int64) {
|
||||||
|
|
||||||
interval := &IntervalNode{Data: data, Offset: offset, Size: int64(len(data))}
|
interval := &IntervalNode{Data: data, Offset: offset, Size: int64(len(data))}
|
||||||
|
|
||||||
|
// append to the tail and return
|
||||||
|
if len(c.lists) == 1 {
|
||||||
|
lastSpan := c.lists[0]
|
||||||
|
if lastSpan.Tail.Offset + lastSpan.Tail.Size == offset {
|
||||||
|
lastSpan.addNodeToTail(interval)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var newLists []*IntervalLinkedList
|
var newLists []*IntervalLinkedList
|
||||||
for _, list := range c.lists {
|
for _, list := range c.lists {
|
||||||
// if list is to the left of new interval, add to the new list
|
// if list is to the left of new interval, add to the new list
|
||||||
|
|
Loading…
Reference in a new issue