forked from SciSharp/BotSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIAgentStorage.cs
48 lines (43 loc) · 1.27 KB
/
IAgentStorage.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using BotSharp.Platform.Models;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace BotSharp.Platform.Abstraction
{
/// <summary>
/// Agent could be persisted in any kind of storage.
/// Example: local file storage, cloud storage, relational database, key-value database or memory
/// </summary>
public interface IAgentStorage<TAgent>
{
/// <summary>
/// Save agent instance
/// </summary>
/// <param name="agent"></param>
/// <returns></returns>
Task<bool> Persist(TAgent agent);
/// <summary>
/// Get agent by id
/// </summary>
/// <param name="agentId"></param>
/// <returns></returns>
Task<TAgent> FetchById(string agentId);
/// <summary>
/// Get agent by name
/// </summary>
/// <param name="agentName"></param>
/// <returns></returns>
Task<TAgent> FetchByName(string agentName);
/// <summary>
/// Query agents
/// </summary>
/// <returns></returns>
Task<List<TAgent>> Query();
/// <summary>
/// Delete agents
/// </summary>
/// <returns></returns>
Task<int> PurgeAllAgents();
}
}