qidpool

package
v0.0.0-...-bf55d75 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package qidpool manages pools of 9P Qids, 13-bit unique identifiers for files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

A Pool maintains a pool of unique 13-bit identifiers for files on a 9P file server. A Pool must be created with a call to New.

func New

func New() *Pool

New returns a new, empty Pool.

func (*Pool) Del

func (p *Pool) Del(name string)

Del removes a Qid from a Pool. Once a Qid is removed from a pool, it will never be used again.

func (*Pool) Do

func (p *Pool) Do(fn func(map[interface{}]interface{}))

Do calls fn while holding the write lock for the pool

func (*Pool) Get

func (p *Pool) Get(name string) (styxproto.Qid, bool)

Get fetches the Qid currently associated with name from the pool. The Qid is only valid if the second return value is true.

func (*Pool) Put

func (p *Pool) Put(name string, qtype uint8) styxproto.Qid

Put creates a new, unique Qid of the given type and adds it to the pool. The returned Qid should be considered read-only. Put will not overwrite an existing Qid; if there is already a Qid associated with name, it is returned instead.

Jump to

Keyboard shortcuts

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