@@ -19,7 +19,6 @@ import struct NIO.TimeAmount
1919
2020@usableFromInline
2121struct Timer < Message> { // FIXME(distributed): deprecate and remove in favor of DistributedActorTimers
22- @usableFromInline
2322 let key : _TimerKey
2423 @usableFromInline
2524 let message : Message ?
@@ -48,7 +47,7 @@ struct TimerEvent {
4847/// timers.cancelTimer(forKey: timerKey)
4948///
5049// TODO: replace timers with AsyncTimerSequence from swift-async-algorithms
51- public struct _TimerKey : Hashable {
50+ internal struct _TimerKey : Hashable {
5251 private let identifier : AnyHashable
5352
5453 @usableFromInline
@@ -87,7 +86,6 @@ public final class _BehaviorTimers<Message: Codable> {
8786 // TODO: eventually replace with our own scheduler implementation
8887 @usableFromInline
8988 internal let dispatchQueue = DispatchQueue . global ( )
90- @usableFromInline
9189 internal var installedTimers : [ _TimerKey : Timer < Message > ] = [ : ]
9290 @usableFromInline
9391 internal unowned var context : _ActorContext < Message >
@@ -114,7 +112,7 @@ public final class _BehaviorTimers<Message: Codable> {
114112 /// Cancels timer associated with the given key.
115113 ///
116114 /// - Parameter key: key of the timer to cancel
117- public func cancel( for key: _TimerKey ) {
115+ internal func cancel( for key: _TimerKey ) {
118116 if let timer = self . installedTimers. removeValue ( forKey: key) {
119117 if context. system. settings. logging. verboseTimers {
120118 self . context. log. trace ( " Cancel timer [ \( key) ] with generation [ \( timer. generation) ] " , metadata: self . metadata)
@@ -126,8 +124,7 @@ public final class _BehaviorTimers<Message: Codable> {
126124 /// Checks for the existence of a scheduler timer for given key (single or periodic).
127125 ///
128126 /// - Returns: true if timer exists, false otherwise
129- @inlinable
130- public func exists( key: _TimerKey ) -> Bool {
127+ internal func exists( key: _TimerKey ) -> Bool {
131128 self . installedTimers [ key] != nil
132129 }
133130
@@ -137,8 +134,7 @@ public final class _BehaviorTimers<Message: Codable> {
137134 /// - key: the key associated with the timer
138135 /// - message: the message that will be sent to `myself`
139136 /// - delay: the delay after which the message will be sent
140- @inlinable
141- public func startSingle( key: _TimerKey , message: Message , delay: Duration ) {
137+ internal func startSingle( key: _TimerKey , message: Message , delay: Duration ) {
142138 self . start ( key: key, message: message, interval: delay, repeated: false )
143139 }
144140
@@ -148,12 +144,10 @@ public final class _BehaviorTimers<Message: Codable> {
148144 /// - key: the key associated with the timer
149145 /// - message: the message that will be sent to `myself`
150146 /// - interval: the interval with which the message will be sent
151- @inlinable
152- public func startPeriodic( key: _TimerKey , message: Message , interval: Duration ) {
147+ internal func startPeriodic( key: _TimerKey , message: Message , interval: Duration ) {
153148 self . start ( key: key, message: message, interval: interval, repeated: true )
154149 }
155150
156- @usableFromInline
157151 internal func start( key: _TimerKey , message: Message , interval: Duration , repeated: Bool ) {
158152 self . cancel ( for: key)
159153
0 commit comments