VOL-1027 : Initial commit of voltha 2.0 data model
Change-Id: Ib8006de1af2166281ccf1c9d7c2b9156991bf4e4
diff --git a/db/model/branch.go b/db/model/branch.go
new file mode 100644
index 0000000..8a37157
--- /dev/null
+++ b/db/model/branch.go
@@ -0,0 +1,34 @@
+package model
+
+// TODO: implement weak references or something equivalent
+// TODO: missing proper logging
+
+type Branch struct {
+ node *Node
+ Txid string
+ origin *Revision
+ revisions map[string]*Revision
+ Latest *Revision
+}
+
+func NewBranch(node *Node, txid string, origin *Revision, autoPrune bool) *Branch {
+ cb := &Branch{}
+ cb.node = node
+ cb.Txid = txid
+ cb.origin = origin
+ cb.revisions = make(map[string]*Revision)
+ cb.Latest = origin
+
+ return cb
+}
+
+// TODO: Check if the following are required
+func (cb *Branch) get(hash string) *Revision {
+ return cb.revisions[hash]
+}
+func (cb *Branch) GetLatest() *Revision {
+ return cb.Latest
+}
+func (cb *Branch) GetOrigin() *Revision {
+ return cb.origin
+}