lang

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

* Copyright (C) 2024 Puter Technologies Inc. * * This file is part of puter-fuse. * * puter-fuse is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2024 Puter Technologies Inc. * * This file is part of puter-fuse. * * puter-fuse is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2024 Puter Technologies Inc. * * This file is part of puter-fuse. * * puter-fuse is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2024 Puter Technologies Inc. * * This file is part of puter-fuse. * * puter-fuse is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathSplit

func PathSplit(path string) []string

Types

type CacheStampedeMap

type CacheStampedeMap[TKey comparable] struct {
	// contains filtered or unexported fields
}

func CreateCacheStampedeMap

func CreateCacheStampedeMap[TKey comparable]() *CacheStampedeMap[TKey]

func (*CacheStampedeMap[TKey]) Lock

func (m *CacheStampedeMap[TKey]) Lock(key TKey) *sync.Mutex

type IMap

type IMap[TKey any, TVal any] interface {
	Get(key TKey) (val TVal, ok bool)
	Set(key TKey, val TVal)
	GetWithFactory(key TKey, factory func() (TVal, bool, error)) (TVal, bool, error)
	Has(key TKey) bool
	Del(key TKey)
	Keys() []TKey
	Values() []TVal
}

type Map

type Map[TKey comparable, TVal any] struct {
	Items map[TKey]TVal
}

func CreateMap

func CreateMap[TKey comparable, TVal any]() *Map[TKey, TVal]

func (*Map[TKey, TVal]) Del

func (m *Map[TKey, TVal]) Del(key TKey)

func (*Map[TKey, TVal]) Get

func (m *Map[TKey, TVal]) Get(key TKey) (TVal, bool)

func (*Map[TKey, TVal]) GetWithFactory

func (m *Map[TKey, TVal]) GetWithFactory(key TKey, factory func() (TVal, bool, error)) (TVal, bool, error)

func (*Map[TKey, TVal]) Has

func (m *Map[TKey, TVal]) Has(key TKey) bool

func (*Map[TKey, TVal]) Keys

func (m *Map[TKey, TVal]) Keys() []TKey

func (*Map[TKey, TVal]) Set

func (m *Map[TKey, TVal]) Set(key TKey, val TVal)

func (*Map[TKey, TVal]) Values

func (m *Map[TKey, TVal]) Values() []TVal

type ProxyMap

type ProxyMap[TKey any, TVal any] struct {
	Delegate IMap[TKey, TVal]
}

func CreateProxyMap

func CreateProxyMap[TKey any, TVal any](delegate IMap[TKey, TVal]) *ProxyMap[TKey, TVal]

func (*ProxyMap[TKey, TVal]) Del

func (m *ProxyMap[TKey, TVal]) Del(key TKey)

func (*ProxyMap[TKey, TVal]) Get

func (m *ProxyMap[TKey, TVal]) Get(key TKey) (val TVal, ok bool)

func (*ProxyMap[TKey, TVal]) GetWithFactory

func (m *ProxyMap[TKey, TVal]) GetWithFactory(key TKey, factory func() (TVal, bool, error)) (TVal, bool, error)

func (*ProxyMap[TKey, TVal]) Has

func (m *ProxyMap[TKey, TVal]) Has(key TKey) bool

func (*ProxyMap[TKey, TVal]) Keys

func (m *ProxyMap[TKey, TVal]) Keys() []TKey

func (*ProxyMap[TKey, TVal]) Set

func (m *ProxyMap[TKey, TVal]) Set(key TKey, val TVal)

func (*ProxyMap[TKey, TVal]) Values

func (m *ProxyMap[TKey, TVal]) Values() []TVal

type SignalReader

type SignalReader struct {
	Delegate io.Reader
	Done     chan struct{}
}

func CreateSignalReader

func CreateSignalReader(delegate io.Reader) *SignalReader

func (*SignalReader) Read

func (r *SignalReader) Read(p []byte) (n int, err error)

type SyncMap

type SyncMap[TKey comparable, TVal any] struct {
	ProxyMap[TKey, TVal]
	// contains filtered or unexported fields
}

func CreateSyncMap

func CreateSyncMap[TKey comparable, TVal any](delegate IMap[TKey, TVal]) *SyncMap[TKey, TVal]

func (*SyncMap[TKey, TVal]) Del

func (m *SyncMap[TKey, TVal]) Del(key TKey)

func (*SyncMap[TKey, TVal]) Get

func (m *SyncMap[TKey, TVal]) Get(key TKey) (TVal, bool)

func (*SyncMap[TKey, TVal]) GetWithFactory

func (m *SyncMap[TKey, TVal]) GetWithFactory(key TKey, factory func() (TVal, bool, error)) (TVal, bool, error)

func (*SyncMap[TKey, TVal]) Has

func (m *SyncMap[TKey, TVal]) Has(key TKey) bool

func (*SyncMap[TKey, TVal]) Keys

func (m *SyncMap[TKey, TVal]) Keys() []TKey

func (*SyncMap[TKey, TVal]) Set

func (m *SyncMap[TKey, TVal]) Set(key TKey, val TVal)

func (*SyncMap[TKey, TVal]) Values

func (m *SyncMap[TKey, TVal]) Values() []TVal

Jump to

Keyboard shortcuts

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