database

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_record_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(index, data *os.File, indexBlock, dataBlock cipher.Block, maxSize, cacheRecords, cacheBytes int) (*Database, error)

func (*Database) Add

func (d *Database) Add(record *Record) (uint64, error)

func (*Database) Delete

func (d *Database) Delete(key uint64) error

func (*Database) Lookup

func (d *Database) Lookup(key uint64, userAgent string) (*Record, error)

func (*Database) RecordsCount

func (d *Database) RecordsCount() int64

type EncryptedFile

type EncryptedFile struct {
	// contains filtered or unexported fields
}

func WrapInCTR

func WrapInCTR(block cipher.Block, impl File) *EncryptedFile

func (*EncryptedFile) ReadAt

func (f *EncryptedFile) ReadAt(p []byte, off int64) (n int, err error)

func (*EncryptedFile) WriteAt

func (f *EncryptedFile) WriteAt(p []byte, off int64) (n int, err error)

type File

type File interface {
	io.ReaderAt
	io.WriterAt
}

type LRU

type LRU struct {
	// contains filtered or unexported fields
}

func NewLRU

func NewLRU(maxSize, maxBytes uint64) (*LRU, error)

func (*LRU) DeleteIfExists

func (l *LRU) DeleteIfExists(key uint64) (existed bool)

func (*LRU) Get

func (l *LRU) Get(key uint64) (value *Record, has bool)

func (*LRU) Set

func (l *LRU) Set(key uint64, value *Record, bytes uint64) (existed bool)

type Record

type Record struct {
	Content     []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	Filename    string `protobuf:"bytes,2,opt,name=filename,proto3" json:"filename,omitempty"`
	SelfBurning bool   `protobuf:"varint,3,opt,name=self_burning,json=selfBurning,proto3" json:"self_burning,omitempty"`
	Redirect    bool   `protobuf:"varint,4,opt,name=redirect,proto3" json:"redirect,omitempty"`
	LongId      bool   `protobuf:"varint,5,opt,name=long_id,json=longId,proto3" json:"long_id,omitempty"`
	ContentType string `protobuf:"bytes,6,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	// contains filtered or unexported fields
}

func (*Record) Descriptor deprecated

func (*Record) Descriptor() ([]byte, []int)

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetContent

func (x *Record) GetContent() []byte

func (*Record) GetContentType

func (x *Record) GetContentType() string

func (*Record) GetFilename

func (x *Record) GetFilename() string

func (*Record) GetLongId

func (x *Record) GetLongId() bool

func (*Record) GetRedirect

func (x *Record) GetRedirect() bool

func (*Record) GetSelfBurning

func (x *Record) GetSelfBurning() bool

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) ProtoReflect

func (x *Record) ProtoReflect() protoreflect.Message

func (*Record) Reset

func (x *Record) Reset()

func (*Record) String

func (x *Record) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL