Debian Codegraph @

paho/session/state/store.go

raw
1 /*
2 * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v2.0
6 * and Eclipse Distribution License v1.0 which accompany this distribution.
7 *
8 * The Eclipse Public License is available at
9 * https://www.eclipse.org/legal/epl-2.0/
10 * and the Eclipse Distribution License is available at
11 * http://www.eclipse.org/org/documents/edl-v10.php.
12 *
13 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
14 */
15
16 package state
17
18 import (
19 "io"
20 )
21
22 // storer must be implemented by session state stores
23 type storer interface {
24 Put(packetID uint16, packetType byte, w io.WriterTo) error // Store the packet
25 Get(packetID uint16) (io.ReadCloser, error) // Retrieve the packet with the specified in ID
26 Delete(id uint16) error // Removes the message with the specified store ID
27
28 // Quarantine sets the message with the specified store ID into an error state; this may mean deleting it or storing
29 // it somewhere separate. This is intended for use when a corrupt packet is detected (as this may result in data
30 // loss, it's beneficial to have access to corrupt packets for analysis).
31 Quarantine(id uint16) error
32
33 List() ([]uint16, error) // Returns packet IDs in the order they were Put
34 Reset() error // Clears the store (deleting all messages)
35 }