camtypes

package
v0.0.0-...-c5af384 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package camtypes is like the types package, but higher-level and contains Camlistore-specific types. It exists mostly to break circular dependencies between index, search, and schema.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientNoServer = addCamError("client-no-server", funcStr(func() string {
		return fmt.Sprintf("No valid server defined. It can be set with the CAMLI_SERVER environment variable, or the --server flag, or in the \"servers\" section of %q (see https://camlistore.org/docs/client-config).", osutil.UserClientConfigPath())
	}))
	ErrClientNoPublicKey = addCamError("client-no-public-key", str("No public key configured: see 'camput init'."))
)

Functions

func Err

func Err(key string) error

Err returns the error registered for key. It panics for an unregistered key.

Types

type BlobMeta

type BlobMeta struct {
	Ref  blob.Ref
	Size uint32

	// CamliType is non-empty if this blob is a Camlistore JSON
	// schema blob. If so, this is its "camliType" attribute.
	CamliType string
}

BlobMeta is the metadata kept for each known blob in the in-memory search index. It's kept as small as possible to save memory.

type Claim

type Claim struct {
	BlobRef, Signer blob.Ref

	Date time.Time
	Type string // "set-attribute", "add-attribute", etc

	// If an attribute modification
	Attr, Value string
	Permanode   blob.Ref

	// If a DeleteClaim or a ShareClaim
	Target blob.Ref
}

func (*Claim) String

func (c *Claim) String() string

type ClaimPtrsByDate

type ClaimPtrsByDate []*Claim

func (ClaimPtrsByDate) Len

func (cl ClaimPtrsByDate) Len() int

func (ClaimPtrsByDate) Less

func (cl ClaimPtrsByDate) Less(i, j int) bool

func (ClaimPtrsByDate) Swap

func (cl ClaimPtrsByDate) Swap(i, j int)

type ClaimsByDate

type ClaimsByDate []Claim

func (ClaimsByDate) Len

func (cl ClaimsByDate) Len() int

func (ClaimsByDate) Less

func (cl ClaimsByDate) Less(i, j int) bool

func (ClaimsByDate) String

func (cl ClaimsByDate) String() string

func (ClaimsByDate) Swap

func (cl ClaimsByDate) Swap(i, j int)

type Edge

type Edge struct {
	From      blob.Ref
	FromType  string // "permanode", "directory", etc
	FromTitle string // name of source permanode or directory
	To        blob.Ref
	BlobRef   blob.Ref // the blob responsible for the edge relationship
}

func (*Edge) String

func (e *Edge) String() string

type EdgesToOpts

type EdgesToOpts struct {
	Max int
}

type FileInfo

type FileInfo struct {
	// FileName is the base name of the file or directory.
	FileName string `json:"fileName"`

	// Size is the size of file. It is not set for directories.
	Size int64 `json:"size"`

	// MIMEType may be set for files, but never for directories.
	MIMEType string `json:"mimeType,omitempty"`

	// Time is the earliest of any modtime, creation time, or EXIF
	// original/modification times found. It may be omitted (zero)
	// if unknown.
	Time *types.Time3339 `json:"time,omitempty"`

	// ModTime is the latest of any modtime, creation time, or EXIF
	// original/modification times found. If ModTime doesn't differ
	// from Time, ModTime is omitted (zero).
	ModTime *types.Time3339 `json:"modTime,omitempty"`

	// WholeRef is the digest of the entire file contents.
	// This will be zero for non-regular files, and may also be zero
	// for files above a certain size threshold.
	WholeRef blob.Ref `json:"wholeRef,omitempty"`
}

FileInfo describes a file or directory.

func (*FileInfo) IsImage

func (fi *FileInfo) IsImage() bool

func (*FileInfo) IsVideo

func (fi *FileInfo) IsVideo() bool

type ImageInfo

type ImageInfo struct {
	// Width is the visible width of the image (after any necessary EXIF rotation).
	Width uint16 `json:"width"`
	// Height is the visible height of the image (after any necessary EXIF rotation).
	Height uint16 `json:"height"`
}

ImageInfo describes an image file.

The Width and Height are uint16s to save memory in index/corpus.go, and that's the max size of a JPEG anyway. If we want to deal with larger sizes, we can use MaxUint16 as a sentinel to mean to look elsewhere. Or ditch this optimization.

type Path

type Path struct {
	Claim, Base, Target blob.Ref
	ClaimDate           time.Time
	Suffix              string // ??
}

func (*Path) String

func (p *Path) String() string

type PermanodeByAttrRequest

type PermanodeByAttrRequest struct {
	Signer blob.Ref

	// Attribute to search. currently supported: "tag", "title"
	// If FuzzyMatch is set, this can be blank to search all
	// attributes.
	Attribute string

	// The attribute value to find exactly (or roughly, if
	// FuzzyMatch is set)
	// If blank, the permanodes with Attribute as an attribute
	// (set to any value) are searched.
	Query string

	FuzzyMatch bool // by default, an exact match is required
	MaxResults int  // optional max results
}

type RecentPermanode

type RecentPermanode struct {
	Permanode   blob.Ref
	Signer      blob.Ref // may be zero (!Valid())
	LastModTime time.Time
}

func (RecentPermanode) Equal

type StatusError

type StatusError struct {
	Error string `json:"error"`
	URL   string `json:"url,omitempty"` // optional
}

Jump to

Keyboard shortcuts

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