-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add internal queue wrappers for the event store
- Loading branch information
1 parent
ccb7172
commit fdfa0c8
Showing
5 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2013-present Snowplow Analytics Ltd. All rights reserved. | ||
// | ||
// This program is licensed to you under the Apache License Version 2.0, | ||
// and you may not use this file except in compliance with the Apache License | ||
// Version 2.0. You may obtain a copy of the Apache License Version 2.0 at | ||
// http://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the Apache License Version 2.0 is distributed on | ||
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
// express or implied. See the Apache License Version 2.0 for the specific | ||
// language governing permissions and limitations there under. | ||
|
||
import Foundation | ||
|
||
class EventStoreIQWrapper: NSObject, EventStore { | ||
|
||
private let eventStore: EventStore | ||
|
||
public init(eventStore: EventStore) { | ||
self.eventStore = eventStore | ||
} | ||
|
||
func addEvent(_ payload: Payload) { | ||
InternalQueue.sync { eventStore.addEvent(payload) } | ||
} | ||
|
||
func removeEvent(withId storeId: Int64) -> Bool { | ||
return InternalQueue.sync { eventStore.removeEvent(withId: storeId) } | ||
} | ||
|
||
func removeEvents(withIds storeIds: [Int64]) -> Bool { | ||
return InternalQueue.sync { eventStore.removeEvents(withIds: storeIds) } | ||
} | ||
|
||
func removeAllEvents() -> Bool { | ||
return InternalQueue.sync { eventStore.removeAllEvents() } | ||
} | ||
|
||
func count() -> UInt { | ||
return InternalQueue.sync { eventStore.count() } | ||
} | ||
|
||
func emittableEvents(withQueryLimit queryLimit: UInt) -> [EmitterEvent] { | ||
return InternalQueue.sync { eventStore.emittableEvents(withQueryLimit: queryLimit) } | ||
} | ||
|
||
func removeOldEvents(maxSize: Int64, maxAge: TimeInterval) { | ||
return InternalQueue.sync { eventStore.removeOldEvents(maxSize: maxSize, maxAge: maxAge) } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters