-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathIPayloadCodec.cs
34 lines (32 loc) · 1.22 KB
/
IPayloadCodec.cs
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
using System.Collections.Generic;
using System.Threading.Tasks;
using Temporalio.Api.Common.V1;
namespace Temporalio.Converters
{
/// <summary>
/// Payload codec for translating bytes to bytes.
/// </summary>
/// <remarks>
/// This is often useful for encryption and/or compression.
/// </remarks>
public interface IPayloadCodec
{
/// <summary>
/// Encode the given collection of payloads.
/// </summary>
/// <param name="payloads">Payloads to encode. Do not mutate these.</param>
/// <returns>
/// Encoded payloads. This must have at least one value and cannot have more than was given.
/// </returns>
Task<IReadOnlyCollection<Payload>> EncodeAsync(IReadOnlyCollection<Payload> payloads);
/// <summary>
/// Decode the given collection of payloads.
/// </summary>
/// <param name="payloads">Payloads to decode. Do not mutate these.</param>
/// <returns>
/// Decoded payloads. This must return the exact same number that was given to
/// <see cref="EncodeAsync" />.
/// </returns>
Task<IReadOnlyCollection<Payload>> DecodeAsync(IReadOnlyCollection<Payload> payloads);
}
}