blob: 4e606f106b27d640aa63adb61c377c68cd9deb26 [file] [log] [blame]
Matt Jeanneretcab955f2019-04-10 15:45:57 -04001/*
2 * Copyright 2018-present Open Networking Foundation
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 */
16package model
17
manikkaraj k9eb6cac2019-05-09 12:32:03 -040018import (
19 "github.com/opencord/voltha-go/db/kvstore"
Chaitrashree G Sbe6ab942019-05-24 06:42:49 -040020 "time"
manikkaraj k9eb6cac2019-05-09 12:32:03 -040021)
22
Matt Jeanneretcab955f2019-04-10 15:45:57 -040023type Revision interface {
24 Finalize(bool)
Matt Jeanneret384d8c92019-05-06 14:27:31 -040025 IsDiscarded() bool
Matt Jeanneretcab955f2019-04-10 15:45:57 -040026 SetConfig(revision *DataRevision)
27 GetConfig() *DataRevision
28 Drop(txid string, includeConfig bool)
29 StorageDrop(txid string, includeConfig bool)
Matt Jeanneret384d8c92019-05-06 14:27:31 -040030 ChildDrop(childType string, childHash string)
Matt Jeanneretcab955f2019-04-10 15:45:57 -040031 SetChildren(name string, children []Revision)
32 GetChildren(name string) []Revision
33 SetAllChildren(children map[string][]Revision)
34 GetAllChildren() map[string][]Revision
35 SetHash(hash string)
36 GetHash() string
37 ClearHash()
38 SetupWatch(key string)
39 SetName(name string)
40 GetName() string
41 SetBranch(branch *Branch)
42 GetBranch() *Branch
43 Get(int) interface{}
44 GetData() interface{}
45 GetNode() *node
manikkaraj k9eb6cac2019-05-09 12:32:03 -040046 LoadFromPersistence(path string, txid string, blobs map[string]*kvstore.KVPair) []Revision
Chaitrashree G Sbe6ab942019-05-24 06:42:49 -040047 SetLastUpdate(ts ...time.Time)
48 GetLastUpdate() time.Time
Matt Jeanneretcab955f2019-04-10 15:45:57 -040049 UpdateData(data interface{}, branch *Branch) Revision
50 UpdateChildren(name string, children []Revision, branch *Branch) Revision
51 UpdateAllChildren(children map[string][]Revision, branch *Branch) Revision
52}