Files
dolt/cmd/noms-diff/diff/queue.go
2016-06-09 13:45:12 -07:00

36 lines
605 B
Go

// Copyright 2016 The Noms Authors. All rights reserved.
// Licensed under the Apache License, version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0
package diff
import (
"container/list"
"github.com/attic-labs/noms/go/types"
)
type diffInfo struct {
path types.Path
key types.Value
v1 types.Value
v2 types.Value
}
type diffQueue struct {
*list.List
}
func (q *diffQueue) PopFront() (diffInfo, bool) {
el := q.Front()
if el == nil {
return diffInfo{}, false
}
q.Remove(el)
return el.Value.(diffInfo), true
}
func NewDiffQueue() *diffQueue {
return &diffQueue{list.New()}
}