Documentation ¶
Index ¶
Constants ¶
View Source
const ( // PartialSize is the size of a partial serial number. PartialSize = memory.Size(len(Partial{})) // FullSize is the size of a full serial number. FullSize = memory.Size(len(storj.SerialNumber{})) )
Variables ¶
View Source
var ( // ErrSerials defines the usedserials store error class. ErrSerials = errs.Class("used serials store error") // ErrSerialAlreadyExists defines an error class for duplicate usedserials. ErrSerialAlreadyExists = errs.Class("used serial already exists in store") )
Functions ¶
This section is empty.
Types ¶
type Full ¶
type Full storj.SerialNumber
Full is a copy of the SerialNumber type. It is necessary so we can define a Less function on it.
type Partial ¶
type Partial [8]byte
Partial represents the last 8 bytes of a serial number. It is used when the first 8 are based on the expiration date.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is an in-memory store for serial numbers.
func (*Table) Add ¶
func (table *Table) Add(satelliteID storj.NodeID, serialNumber storj.SerialNumber, expiration time.Time) error
Add adds a serial to the store, or returns an error if the serial number was already added. It randomly deletes items from the store if the set maxMemory is exceeded.
func (*Table) DeleteExpired ¶
DeleteExpired deletes expired serial numbers if their expiration hour has passed.
Click to show internal directories.
Click to hide internal directories.