aboutsummaryrefslogtreecommitdiffstats
path: root/worker/jmap/cache/state.go
blob: 6538ccad38d1d78bcedc60fc13b36e1498d586a2 (plain) (blame)
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
package cache

func (c *JMAPCache) GetMailboxState() (string, error) {
	buf, err := c.get(mailboxStateKey)
	if err != nil {
		return "", err
	}
	return string(buf), nil
}

func (c *JMAPCache) PutMailboxState(state string) error {
	return c.put(mailboxStateKey, []byte(state))
}

func (c *JMAPCache) GetThreadState() (string, error) {
	buf, err := c.get(threadStateKey)
	if err != nil {
		return "", err
	}
	return string(buf), nil
}

func (c *JMAPCache) PutThreadState(state string) error {
	return c.put(threadStateKey, []byte(state))
}

func (c *JMAPCache) GetEmailState() (string, error) {
	buf, err := c.get(emailStateKey)
	if err != nil {
		return "", err
	}
	return string(buf), nil
}

func (c *JMAPCache) PutEmailState(state string) error {
	return c.put(emailStateKey, []byte(state))
}

const (
	mailboxStateKey = "state/mailbox"
	emailStateKey   = "state/email"
	threadStateKey  = "state/thread"
)