v0.0.0-...-a5a65f0 Latest Latest

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

Go to latest
Published: Dec 30, 2017 License: Apache-2.0 Imports: 12 Imported by: 333



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.



This section is empty.


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", osutil.UserClientConfigPath())
	ErrClientNoPublicKey = addCamError("client-no-public-key", str("No public key configured: see 'camput init'."))


func Err

func Err(key string) error

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


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 Discovery

type Discovery struct {
	BlobRoot     string `json:"blobRoot"`
	JSONSignRoot string `json:"jsonSignRoot"`
	HelpRoot     string `json:"helpRoot"`
	ImporterRoot string `json:"importerRoot"`
	SearchRoot   string `json:"searchRoot"`
	StatusRoot   string `json:"statusRoot"`
	ShareRoot    string `json:"shareRoot"`

	OwnerName string `json:"ownerName"` // Name of the owner.
	UserName  string `json:"userName"`  // Name of the user.

	// StorageGeneration is the UUID for the storage generation.
	StorageGeneration string `json:"storageGeneration,omitempty"`
	// StorageGenerationError is the error that occurred on generating the storage, if any.
	StorageGenerationError string `json:"storageGenerationError,omitempty"`
	// StorageInitTime is the initialization time of the storage.
	StorageInitTime types.Time3339 `json:"storageInitTime,omitempty"`

	ThumbVersion string `json:"thumbVersion"` // Thumbnailing version.

	// AuthToken is an auth.OpAll token used by the web UI and the WebSocket.
	// It is randomly generated the first time discovery is served.
	AuthToken string `json:"authToken"`

	// SyncHandlers lists discovery information about the available sync handlers.
	SyncHandlers []SyncHandlerDiscovery `json:"syncHandlers,omitempty"`
	// Signing contains discovery information for signing.
	Signing *SignDiscovery `json:"signing,omitempty"`
	// UIDiscovery contains discovery information for the UI.

Discovery is the JSON response for discovery requests.

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) IsText

func (fi *FileInfo) IsText() bool

func (*FileInfo) IsVideo

func (fi *FileInfo) IsVideo() bool

type FileSearchResponse

type FileSearchResponse struct {

	Files []blob.Ref `json:"files"` // Refs of the result files. Never nil.

FileSearchResponse is the JSON response to a file search request.

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 Location

type Location struct {
	// Latitude and Longitude represent the point location of this blob,
	// such as the place where a photo was taken.
	// Negative values represent positions south of the equator or
	// west of the prime meridian:
	// Northern latitudes are positive, southern latitudes are negative.
	// Eastern longitudes are positive, western longitudes are negative.
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`

Location describes a file or permanode that has a location.

type LocationBounds

type LocationBounds struct {
	North float64 `json:"north"`
	South float64 `json:"south"`
	West  float64 `json:"west"`
	East  float64 `json:"east"`

LocationBounds is a location area delimited by its fields. See Location for the fields meanings and values.

func (LocationBounds) Expand

func (b LocationBounds) Expand(loc Location) LocationBounds

Expand returns a new LocationBounds nb. If either of loc coordinates is outside of b, nb is the dimensions of b expanded as little as possible in order to include loc. Otherwise, nb is just a copy of b.

type Longitude

type Longitude float64

func (Longitude) WrapTo180

func (l Longitude) WrapTo180() float64

WrapTo180 returns l converted to the [-180,180] interval.

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

	// At, if non-zero, specifies that the attribute must have been set at
	// the latest at At.
	At time.Time

type PublishRootDiscovery

type PublishRootDiscovery struct {
	Name string `json:"name"`
	// Prefix lists prefixes belonging to the publishing root.
	Prefix []string `json:"prefix"`
	// CurrentPermanode is the permanode associated with the publishing root.
	CurrentPermanode blob.Ref `json:"currentPermanode"`

PublishRootDiscovery contains discovery information for the publish roots.

type RecentPermanode

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

func (RecentPermanode) Equal

type SearchErrorResponse

type SearchErrorResponse struct {
	Error     string `json:"error,omitempty"`     // The error message.
	ErrorType string `json:"errorType,omitempty"` // The type of the error.

SearchErrorResponse is the JSON error response for a search request.

type SignDiscovery

type SignDiscovery struct {
	// PublicKey is the path to the public signing key.
	PublicKey string `json:"publicKey,omitempty"`
	// PublicKeyBlobRef is the blob.Ref for the public key.
	PublicKeyBlobRef blob.Ref `json:"publicKeyBlobRef,omitempty"`
	// PublicKeyID is the ID of the public key.
	PublicKeyID string `json:"publicKeyId"`
	// SignHandler is the URL path prefix to the signing handler.
	SignHandler string `json:"signHandler"`
	// VerifyHandler it the URL path prefix to the signature verification handler.
	VerifyHandler string `json:"verifyHandler"`

SignDiscovery contains discovery information for jsonsign. It is part of the server's JSON response for discovery requests.

type StatusError

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

type SyncHandlerDiscovery

type SyncHandlerDiscovery struct {
	// From is the source of the sync handler.
	From string `json:"from"`
	// To is the destination of the sync handler.
	To string `json:"to"`
	// ToIndex is true if the sync is from a blob storage to an index.
	ToIndex bool `json:"toIndex"`

SyncHandlerDiscovery contains discovery information about a sync handler. It is part of the JSON response to discovery requests.

type UIDiscovery

type UIDiscovery struct {
	// UIRoot is the URL prefix path to the UI handler.
	UIRoot string `json:"uiRoot"`
	// UploadHelper is the path to the upload helper.
	UploadHelper string `json:"uploadHelper"`
	// DirectoryHelper is the path to the directory helper.
	DirectoryHelper string `json:"directoryHelper"`
	// DownloaderHelper is the path to the downloader helper.
	DownloadHelper string `json:"downloadHelper"`
	// PublishRoots lists discovery information for all publishing roots,
	// mapped by the respective root name.
	PublishRoots map[string]*PublishRootDiscovery `json:"publishRoots"`
	// MapClustering defines whether to cluster position markers on the map aspect.
	MapClustering bool `json:"mapClustering"`

UIDiscovery contains discovery information for the user interface. It is part of the JSON response to discovery requests.

type VerifyResponse

type VerifyResponse struct {
	// SignatureValid is true if the signature is valid.
	SignatureValid bool `json:"signatureValid"`
	// ErrorMessage contains the error that occurred, if any.
	ErrorMessage string `json:"errorMessage,omitempty"`
	// SignerKeyId is the ID of the signing key.
	SignerKeyId string `json:"signerKeyId,omitempty"`
	// VerifiedData contains the JSON values from the payload that we signed.
	VerifiedData map[string]interface{} `json:"verifiedData,omitempty"`

VerifyResponse is the JSON response for a signature verification request.

Jump to

Keyboard shortcuts

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