blob: 71c5d0c121fd2c7748ce98d586c4c21f70da22a0 [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 (
Manikkaraj kb1d51442019-07-23 10:41:02 -040019 "context"
Scott Bakerf8424cc2019-10-18 11:26:50 -070020 "github.com/opencord/voltha-lib-go/pkg/db/kvstore"
Chaitrashree G Sbe6ab942019-05-24 06:42:49 -040021 "time"
manikkaraj k9eb6cac2019-05-09 12:32:03 -040022)
23
Matt Jeanneretcab955f2019-04-10 15:45:57 -040024type Revision interface {
25 Finalize(bool)
26 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)
David Bainbridgebe7cac12019-10-23 19:53:07 +000031 ChildDropByName(childName string)
Matt Jeanneretcab955f2019-04-10 15:45:57 -040032 SetChildren(name string, children []Revision)
33 GetChildren(name string) []Revision
34 SetAllChildren(children map[string][]Revision)
35 GetAllChildren() map[string][]Revision
36 SetHash(hash string)
37 GetHash() string
38 ClearHash()
Manikkaraj kb1d51442019-07-23 10:41:02 -040039 getVersion() int64
Matt Jeanneretcab955f2019-04-10 15:45:57 -040040 SetupWatch(key string)
41 SetName(name string)
42 GetName() string
43 SetBranch(branch *Branch)
44 GetBranch() *Branch
45 Get(int) interface{}
46 GetData() interface{}
47 GetNode() *node
Chaitrashree G Sbe6ab942019-05-24 06:42:49 -040048 SetLastUpdate(ts ...time.Time)
49 GetLastUpdate() time.Time
Manikkaraj kb1d51442019-07-23 10:41:02 -040050 LoadFromPersistence(ctx context.Context, path string, txid string, blobs map[string]*kvstore.KVPair) []Revision
51 UpdateData(ctx context.Context, data interface{}, branch *Branch) Revision
52 UpdateChildren(ctx context.Context, name string, children []Revision, branch *Branch) Revision
Matt Jeanneretcab955f2019-04-10 15:45:57 -040053 UpdateAllChildren(children map[string][]Revision, branch *Branch) Revision
54}