1type IStore interface {
2 // --- Client ---
3 RegisterClient(_ int, rlm realm, typ types.ClientType, impl lightclient.ClientImpl)
4 ClientRegistry(typ types.ClientType) (lightclient.ClientImpl, bool)
5 HasRegisteredClient(typ types.ClientType) bool
6 AddClient(_ int, rlm realm, typ types.ClientType, creator address, lc lightclient.Interface) types.ClientId
7 GetClientImpl(clientId types.ClientId) (lightclient.ClientImpl, bool)
8 ClientExists(clientId types.ClientId) bool
9 ClientType(clientId types.ClientId) (types.ClientType, bool)
10 GetLightClient(clientId types.ClientId) (lightclient.Interface, bool)
11 SetLightClient(_ int, rlm realm, clientId types.ClientId, lc lightclient.Interface) bool
12 SaveClientState(_ int, rlm realm, clientId types.ClientId, clientStateBytes []byte) bool
13 SaveConsensusState(_ int, rlm realm, clientId types.ClientId, height types.Height, consensusStateBytes []byte) bool
14 SaveClientStore(_ int, rlm realm, clientId types.ClientId, key string, value []byte) bool
15
16 // --- Connection ---
17 NextConnectionId(_ int, rlm realm) types.ConnectionId
18 SaveConnection(_ int, rlm realm, connectionId types.ConnectionId, connection types.Connection)
19 GetConnection(connectionId types.ConnectionId) (types.Connection, bool)
20
21 // --- Channel ---
22 NextChannelId(_ int, rlm realm) types.ChannelId
23 CreateChannel(_ int, rlm realm, channelId types.ChannelId, channel types.Channel, portId types.Bytes)
24 SaveChannel(_ int, rlm realm, channelId types.ChannelId, channel types.Channel)
25 GetChannels() ([]types.Channel, error)
26 GetChannel(channelId types.ChannelId) (types.Channel, bool)
27 GetChannelOwner(channelId types.ChannelId) (types.Bytes, bool)
28
29 // --- App registry ---
30 GetAppByPortId(portId types.Bytes) (app.IApp, bool)
31 HasApp(portId types.Bytes) bool
32 RegisterAppAtPort(_ int, rlm realm, portId types.Bytes, a app.IApp)
33
34 // --- Packet commitment (source side) ---
35 HasPacketCommitment(packet types.Packet) bool
36 CommitPacket(_ int, rlm realm, packet types.Packet)
37 // SetPacketAcknowledged flips a packet's source commitment to the acknowledged
38 // marker. The acknowledge/timeout state machine (the read-check that the
39 // commitment exists and is not already acknowledged) lives in the mustGetImpl().
40 SetPacketAcknowledged(_ int, rlm realm, packet types.Packet)
41
42 // --- Packet receipt / acknowledgement (destination side) ---
43 HasPacketReceipt(packet types.Packet) bool
44 SetPacketReceipt(_ int, rlm realm, packet types.Packet)
45 CommitAcknowledgement(_ int, rlm realm, packet types.Packet, ack []byte)
46 AcknowledgementReceipt(channelId types.ChannelId, packet types.Packet) (types.H256, bool)
47
48 // --- Batch ---
49 PacketCommitment(channelId types.ChannelId, packet types.Packet) (types.H256, bool)
50 SaveBatchPackets(_ int, rlm realm, channelId types.ChannelId, batchHash, value types.H256)
51 SaveBatchReceipts(_ int, rlm realm, channelId types.ChannelId, batchHash, value types.H256)
52
53 // --- Committed proofs ---
54 SaveMembershipProof(_ int, rlm realm, clientId types.ClientId, proofHeight uint64, path []byte, value types.H256)
55 SaveNonMembershipProof(_ int, rlm realm, clientId types.ClientId, proofHeight uint64, path []byte, value types.H256)
56
57 // --- Read-only query support ---
58 ClientStateBytes(clientId types.ClientId) ([]byte, bool)
59 ConsensusStateBytes(clientId types.ClientId, height types.Height) ([]byte, bool)
60 BatchPacketsAt(batchHash types.H256) (types.H256, bool)
61 BatchReceiptsAt(batchHash types.H256) (types.H256, bool)
62 MembershipProofAt(clientId types.ClientId, proofHeight uint64, path []byte) (types.H256, bool)
63 HasNonMembershipProof(clientId types.ClientId, proofHeight uint64, path []byte) bool
64}