Matt Jeanneret | cab955f | 2019-04-10 15:45:57 -0400 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package model |
| 17 | |
manikkaraj k | 9eb6cac | 2019-05-09 12:32:03 -0400 | [diff] [blame] | 18 | import ( |
Manikkaraj k | b1d5144 | 2019-07-23 10:41:02 -0400 | [diff] [blame] | 19 | "context" |
Scott Baker | f8424cc | 2019-10-18 11:26:50 -0700 | [diff] [blame] | 20 | "github.com/opencord/voltha-lib-go/pkg/db/kvstore" |
Chaitrashree G S | be6ab94 | 2019-05-24 06:42:49 -0400 | [diff] [blame] | 21 | "time" |
manikkaraj k | 9eb6cac | 2019-05-09 12:32:03 -0400 | [diff] [blame] | 22 | ) |
| 23 | |
Matt Jeanneret | cab955f | 2019-04-10 15:45:57 -0400 | [diff] [blame] | 24 | type 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 Jeanneret | 384d8c9 | 2019-05-06 14:27:31 -0400 | [diff] [blame] | 30 | ChildDrop(childType string, childHash string) |
Matt Jeanneret | cab955f | 2019-04-10 15:45:57 -0400 | [diff] [blame] | 31 | 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() |
Manikkaraj k | b1d5144 | 2019-07-23 10:41:02 -0400 | [diff] [blame] | 38 | getVersion() int64 |
Matt Jeanneret | cab955f | 2019-04-10 15:45:57 -0400 | [diff] [blame] | 39 | SetupWatch(key string) |
| 40 | SetName(name string) |
| 41 | GetName() string |
| 42 | SetBranch(branch *Branch) |
| 43 | GetBranch() *Branch |
| 44 | Get(int) interface{} |
| 45 | GetData() interface{} |
| 46 | GetNode() *node |
Chaitrashree G S | be6ab94 | 2019-05-24 06:42:49 -0400 | [diff] [blame] | 47 | SetLastUpdate(ts ...time.Time) |
| 48 | GetLastUpdate() time.Time |
Manikkaraj k | b1d5144 | 2019-07-23 10:41:02 -0400 | [diff] [blame] | 49 | LoadFromPersistence(ctx context.Context, path string, txid string, blobs map[string]*kvstore.KVPair) []Revision |
| 50 | UpdateData(ctx context.Context, data interface{}, branch *Branch) Revision |
| 51 | UpdateChildren(ctx context.Context, name string, children []Revision, branch *Branch) Revision |
Matt Jeanneret | cab955f | 2019-04-10 15:45:57 -0400 | [diff] [blame] | 52 | UpdateAllChildren(children map[string][]Revision, branch *Branch) Revision |
| 53 | } |