aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/system/op.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-23 14:15:13 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-23 14:15:13 +0900
commite35c5fe3ed995d352c001bd7e35bd1214ca583da (patch)
tree27fd84e715670374eb126590a7e918ab7e33dd12 /internal/system/op.go
parent20195ece478a28b2bc7abc78cd220f900958eb35 (diff)
system: sys comparison method
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/system/op.go')
-rw-r--r--internal/system/op.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/system/op.go b/internal/system/op.go
index 67a637bf..fcfc29b2 100644
--- a/internal/system/op.go
+++ b/internal/system/op.go
@@ -65,6 +65,20 @@ func (sys *I) UID() int {
return sys.uid
}
+func (sys *I) Equal(v *I) bool {
+ if v == nil || sys.uid != v.uid || len(sys.ops) != len(v.ops) {
+ return false
+ }
+
+ for i, o := range sys.ops {
+ if !o.Is(v.ops[i]) {
+ return false
+ }
+ }
+
+ return true
+}
+
func (sys *I) Commit() error {
sys.lock.Lock()
defer sys.lock.Unlock()