Skip to content

Commit 9d37028

Browse files
committed
clean up
1 parent 2330e34 commit 9d37028

File tree

5 files changed

+1198
-44
lines changed

5 files changed

+1198
-44
lines changed

apps/workspace-engine/pkg/changeset/changeset.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Change[T any] struct {
2323
type ChangeSet[T any] struct {
2424
IsInitialLoad bool
2525
Changes []Change[T]
26-
Mutex sync.Mutex
26+
mutex sync.Mutex
2727
}
2828

2929
func NewChangeSet[T any]() *ChangeSet[T] {
@@ -32,13 +32,25 @@ func NewChangeSet[T any]() *ChangeSet[T] {
3232
}
3333
}
3434

35+
func (cs *ChangeSet[T]) Lock() {
36+
cs.mutex.Lock()
37+
}
38+
39+
func (cs *ChangeSet[T]) Unlock() {
40+
cs.mutex.Unlock()
41+
}
42+
3543
func (cs *ChangeSet[T]) Record(changeType ChangeType, entity T) {
36-
cs.Mutex.Lock()
37-
defer cs.Mutex.Unlock()
44+
cs.mutex.Lock()
45+
defer cs.mutex.Unlock()
3846

3947
cs.Changes = append(cs.Changes, Change[T]{
4048
Type: changeType,
4149
Entity: entity,
4250
Timestamp: time.Now(),
4351
})
4452
}
53+
54+
func (cs *ChangeSet[T]) Process() *Processor[T] {
55+
return NewProcessor(cs)
56+
}

0 commit comments

Comments
 (0)