1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 11:46:16 +00:00
mycorrhiza/hyphae/interface.go
2022-02-19 11:31:54 +03:00

34 lines
598 B
Go

package hyphae
import "sync"
type HyphaKind int
const (
HyphaEmpty HyphaKind = iota
HyphaText
HyphaMedia
)
// Hypher is a temporary name for this interface. The name will become Hypha, once the struct with the said name is deprecated for good.
type Hypher interface {
sync.Locker
CanonicalName() string
Kind() HyphaKind
DoesExist() bool
HasTextPart() bool
TextPartPath() string
}
// DeleteHypha deletes the hypha from the storage.
func DeleteHypha(h Hypher) {
byNamesMutex.Lock()
h.Lock()
delete(byNames, h.CanonicalName())
decrementCount()
byNamesMutex.Unlock()
h.Unlock()
}