strstore

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StrStore

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

StrStore is used to store string with less GC overhead. The string stored here should not be longer than `pageSize` and does not need to be deleted.

func New

func New() *StrStore

New creates a StrStore instance.

func NewFromSlice

func NewFromSlice(ss []string) (*StrStore, []int)

NewFromSlice constructs a StrStore with the input string slice and returns the StrStore and indexes for the following reads. It panics if any string in the slice is longer than math.MaxUint32.

func (*StrStore) Get

func (s *StrStore) Get(idx int) string

Get gets the string with the idx. It returns empty string if the no string can be found with the input idx

func (*StrStore) Len

func (s *StrStore) Len() int

Len returns the total length of bytes.

func (*StrStore) Load

func (s *StrStore) Load(ss []string) ([]int, error)

Load resets the StrStore and set from input string slices.

Jump to

Keyboard shortcuts

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