forked from FreeDSx/LDAP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueueWriterConfig.php
More file actions
37 lines (32 loc) · 1015 Bytes
/
Copy pathQueueWriterConfig.php
File metadata and controls
37 lines (32 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
/**
* This file is part of the FreeDSx LDAP package.
*
* (c) Chad Sikorra <Chad.Sikorra@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FreeDSx\Ldap\Protocol\Queue\Response;
/**
* Tells the response writer how to drive a stream; defaults to the fully-batched, unpolled fast path.
*
* @internal
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
final readonly class QueueWriterConfig
{
/**
* @param int $signalInterval poll for a cancel/abandon signal every N messages; 0 disables it.
* @param bool $flushPerMessage flush the socket after each message instead of the default buffering.
*/
public function __construct(
public int $signalInterval = 0,
public bool $flushPerMessage = false,
) {}
public function mustFlushOrSignal(): bool
{
return $this->signalInterval > 0 || $this->flushPerMessage;
}
}