2011-03-13 23:10:15 +00:00
|
|
|
/*
|
|
|
|
Copyright 2011 Google Inc.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package search
|
|
|
|
|
|
|
|
import (
|
2011-11-29 19:19:32 +00:00
|
|
|
"bytes"
|
|
|
|
"fmt"
|
2011-07-03 20:33:56 +00:00
|
|
|
"strings"
|
2011-03-14 02:27:59 +00:00
|
|
|
"time"
|
2011-11-29 19:19:32 +00:00
|
|
|
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
"camlistore.org/pkg/blobref"
|
2011-03-13 23:10:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Result struct {
|
|
|
|
BlobRef *blobref.BlobRef
|
2011-03-14 02:27:59 +00:00
|
|
|
Signer *blobref.BlobRef // may be nil
|
|
|
|
LastModTime int64 // seconds since epoch
|
|
|
|
}
|
|
|
|
|
2011-11-29 19:19:32 +00:00
|
|
|
// Results exists mostly for debugging, to provide a String method on
|
|
|
|
// a slice of Result.
|
|
|
|
type Results []*Result
|
|
|
|
|
|
|
|
func (s Results) String() string {
|
|
|
|
var buf bytes.Buffer
|
|
|
|
fmt.Fprintf(&buf, "[%d search results: ", len(s))
|
|
|
|
for _, r := range s {
|
|
|
|
fmt.Fprintf(&buf, "{BlobRef: %s, Signer: %s, LastModTime: %d}",
|
|
|
|
r.BlobRef, r.Signer, r.LastModTime)
|
|
|
|
}
|
|
|
|
buf.WriteString("]")
|
|
|
|
return buf.String()
|
|
|
|
}
|
|
|
|
|
2011-03-14 02:27:59 +00:00
|
|
|
// TODO: move this to schema or something?
|
|
|
|
type Claim struct {
|
|
|
|
BlobRef, Signer, Permanode *blobref.BlobRef
|
|
|
|
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
Date time.Time
|
2011-03-14 02:27:59 +00:00
|
|
|
Type string // "set-attribute", "add-attribute", etc
|
|
|
|
|
|
|
|
// If an attribute modification
|
|
|
|
Attr, Value string
|
2011-03-13 23:10:15 +00:00
|
|
|
}
|
|
|
|
|
2011-11-29 20:40:33 +00:00
|
|
|
func (c *Claim) String() string {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
"search.Claim{BlobRef: %s, Signer: %s, Permanode: %s, Date: %s, Type: %s, Attr: %s, Value: %s}",
|
|
|
|
c.BlobRef, c.Signer, c.Permanode, c.Date, c.Type, c.Attr, c.Value)
|
|
|
|
}
|
|
|
|
|
2011-03-14 03:51:58 +00:00
|
|
|
type ClaimList []*Claim
|
|
|
|
|
|
|
|
func (cl ClaimList) Len() int {
|
|
|
|
return len(cl)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (cl ClaimList) Less(i, j int) bool {
|
|
|
|
// TODO: memoize Seconds in unexported Claim field
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
return cl[i].Date.Unix() < cl[j].Date.Unix()
|
2011-03-14 03:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (cl ClaimList) Swap(i, j int) {
|
|
|
|
cl[i], cl[j] = cl[j], cl[i]
|
|
|
|
}
|
|
|
|
|
2011-11-29 20:40:33 +00:00
|
|
|
func (cl ClaimList) String() string {
|
|
|
|
var buf bytes.Buffer
|
|
|
|
fmt.Fprintf(&buf, "[%d claims: ", len(cl))
|
|
|
|
for _, r := range cl {
|
|
|
|
buf.WriteString(r.String())
|
|
|
|
}
|
|
|
|
buf.WriteString("]")
|
|
|
|
return buf.String()
|
|
|
|
}
|
|
|
|
|
2011-06-12 07:20:57 +00:00
|
|
|
type FileInfo struct {
|
2011-07-01 21:33:15 +00:00
|
|
|
Size int64 `json:"size"`
|
|
|
|
FileName string `json:"fileName"`
|
|
|
|
MimeType string `json:"mimeType"`
|
2011-06-12 07:20:57 +00:00
|
|
|
}
|
|
|
|
|
2011-07-03 20:33:56 +00:00
|
|
|
func (fi *FileInfo) IsImage() bool {
|
|
|
|
return strings.HasPrefix(fi.MimeType, "image/")
|
|
|
|
}
|
|
|
|
|
2011-06-26 00:50:38 +00:00
|
|
|
type Path struct {
|
2011-06-28 01:42:00 +00:00
|
|
|
Claim, Base, Target *blobref.BlobRef
|
2011-07-01 21:33:15 +00:00
|
|
|
ClaimDate string
|
|
|
|
Suffix string
|
2011-06-26 00:50:38 +00:00
|
|
|
}
|
|
|
|
|
2011-12-02 01:28:32 +00:00
|
|
|
func (p *Path) String() string {
|
|
|
|
return fmt.Sprintf("Path{Claim: %v, %v; Base: %v + Suffix %q => Target %v}",
|
|
|
|
p.Claim, p.ClaimDate, p.Base, p.Suffix, p.Target)
|
|
|
|
}
|
|
|
|
|
2011-09-03 22:48:49 +00:00
|
|
|
type PermanodeByAttrRequest struct {
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
Signer *blobref.BlobRef
|
2011-12-04 21:19:16 +00:00
|
|
|
|
|
|
|
// Attribute to search. currently supported: "tag", "title"
|
|
|
|
// If FuzzyMatch is set, this can be blank to search all
|
|
|
|
// attributes.
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
Attribute string
|
2011-12-04 21:19:16 +00:00
|
|
|
|
|
|
|
// The attribute value to find exactly (or roughly, if
|
|
|
|
// FuzzyMatch is set)
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
Query string
|
2011-12-04 21:19:16 +00:00
|
|
|
|
2011-08-25 13:15:38 +00:00
|
|
|
FuzzyMatch bool // by default, an exact match is required
|
|
|
|
MaxResults int // optional max results
|
|
|
|
}
|
|
|
|
|
2012-11-03 15:08:37 +00:00
|
|
|
type EdgesToOpts struct {
|
|
|
|
Max int
|
|
|
|
// TODO: filter by type?
|
|
|
|
}
|
|
|
|
|
|
|
|
type Edge struct {
|
|
|
|
From *blobref.BlobRef
|
|
|
|
FromType string // "permanode", "directory", etc
|
|
|
|
FromTitle string // name of source permanode or directory
|
|
|
|
To *blobref.BlobRef
|
|
|
|
}
|
|
|
|
|
2012-11-05 09:29:42 +00:00
|
|
|
func (e *Edge) String() string {
|
|
|
|
return fmt.Sprintf("[edge from:%s to:%s type:%s title:%s]", e.From, e.To, e.FromType, e.FromTitle)
|
|
|
|
}
|
|
|
|
|
2011-03-13 23:10:15 +00:00
|
|
|
type Index interface {
|
2011-10-27 21:01:10 +00:00
|
|
|
// dest must be closed, even when returning an error.
|
2011-03-13 23:10:15 +00:00
|
|
|
// limit is <= 0 for default. smallest possible default is 0
|
|
|
|
GetRecentPermanodes(dest chan *Result,
|
2011-11-27 15:52:39 +00:00
|
|
|
owner *blobref.BlobRef,
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
limit int) error
|
2011-03-14 02:27:59 +00:00
|
|
|
|
2011-08-25 13:15:38 +00:00
|
|
|
// SearchPermanodes finds permanodes matching the provided
|
|
|
|
// request and sends unique permanode blobrefs to dest.
|
|
|
|
// In particular, if request.FuzzyMatch is true, a fulltext
|
|
|
|
// search is performed (if supported by the attribute(s))
|
|
|
|
// instead of an exact match search.
|
|
|
|
// Additionally, if request.Attribute is blank, all attributes
|
2012-11-09 18:00:47 +00:00
|
|
|
// are searched (as fulltext), otherwise the search is
|
2011-08-25 13:15:38 +00:00
|
|
|
// restricted to the named attribute.
|
|
|
|
//
|
|
|
|
// dest is always closed, regardless of the error return value.
|
2011-09-03 22:48:49 +00:00
|
|
|
SearchPermanodesWithAttr(dest chan<- *blobref.BlobRef,
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
request *PermanodeByAttrRequest) error
|
2011-08-25 13:15:38 +00:00
|
|
|
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
GetOwnerClaims(permaNode, owner *blobref.BlobRef) (ClaimList, error)
|
2011-03-14 03:51:58 +00:00
|
|
|
|
2012-05-13 19:06:21 +00:00
|
|
|
// os.ErrNotExist should be returned if the blob isn't known
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
GetBlobMimeType(blob *blobref.BlobRef) (mime string, size int64, err error)
|
2011-06-09 19:55:38 +00:00
|
|
|
|
2011-12-03 16:14:17 +00:00
|
|
|
// ExistingFileSchemas returns 0 or more blobrefs of "bytes"
|
|
|
|
// (TODO(bradfitz): or file?) schema blobs that represent the
|
|
|
|
// bytes of a file given in bytesRef. The file schema blobs
|
|
|
|
// returned are not guaranteed to reference chunks that still
|
|
|
|
// exist on the blobservers, though. It's purely a hint for
|
|
|
|
// clients to avoid uploads if possible. Before re-using any
|
|
|
|
// returned blobref they should be checked.
|
|
|
|
//
|
|
|
|
// Use case: a user drag & drops a large file onto their
|
|
|
|
// browser to upload. (imagine that "large" means anything
|
|
|
|
// larger than a blobserver's max blob size) JavaScript can
|
|
|
|
// first SHA-1 the large file locally, then send the
|
|
|
|
// wholeFileRef to this call and see if they'd previously
|
|
|
|
// uploaded the same file in the past. If so, the upload
|
|
|
|
// can be avoided if at least one of the returned schemaRefs
|
|
|
|
// can be validated (with a validating HEAD request) to still
|
|
|
|
// all exist on the blob server.
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
ExistingFileSchemas(wholeFileRef *blobref.BlobRef) (schemaRefs []*blobref.BlobRef, err error)
|
2011-06-12 07:20:57 +00:00
|
|
|
|
2012-05-13 19:06:21 +00:00
|
|
|
// Should return os.ErrNotExist if not found.
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
GetFileInfo(fileRef *blobref.BlobRef) (*FileInfo, error)
|
2011-06-17 04:18:04 +00:00
|
|
|
|
|
|
|
// Given an owner key, a camliType 'claim', 'attribute' name,
|
|
|
|
// and specific 'value', find the most recent permanode that has
|
|
|
|
// a corresponding 'set-attribute' claim attached.
|
2012-05-13 19:06:21 +00:00
|
|
|
// Returns os.ErrNotExist if none is found.
|
2012-05-13 20:30:42 +00:00
|
|
|
// TODO(bradfitz): ErrNotExist here is a weird error message ("file" not found). change.
|
2011-11-28 02:50:50 +00:00
|
|
|
// Only attributes white-listed by IsIndexedAttribute are valid.
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
PermanodeOfSignerAttrValue(signer *blobref.BlobRef, attr, val string) (*blobref.BlobRef, error)
|
2011-06-26 00:50:38 +00:00
|
|
|
|
2011-12-01 18:43:57 +00:00
|
|
|
// PathsOfSignerTarget queries the index about "camliPath:"
|
|
|
|
// URL-dispatch attributes.
|
|
|
|
//
|
|
|
|
// It returns a list of all the path claims that have been signed
|
|
|
|
// by the provided signer and point at the given target.
|
|
|
|
//
|
|
|
|
// This is used when editing a permanode, to figure work up
|
|
|
|
// the name resolution tree backwards ultimately to a
|
|
|
|
// camliRoot permanode (which should know its base URL), and
|
|
|
|
// then the complete URL(s) of a target can be found.
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
PathsOfSignerTarget(signer, target *blobref.BlobRef) ([]*Path, error)
|
2011-06-28 01:42:00 +00:00
|
|
|
|
2011-06-30 21:36:07 +00:00
|
|
|
// All Path claims for (signer, base, suffix)
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
PathsLookup(signer, base *blobref.BlobRef, suffix string) ([]*Path, error)
|
2011-06-30 21:36:07 +00:00
|
|
|
|
|
|
|
// Most recent Path claim for (signer, base, suffix) as of
|
|
|
|
// provided time 'at', or most recent if 'at' is nil.
|
Update from r60 to [almost] Go 1.
A lot is still broken, but most stuff at least compiles now.
The directory tree has been rearranged now too. Go libraries are now
under "pkg". Fully qualified, they are e.g. "camlistore.org/pkg/jsonsign".
The go tool cannot yet fetch from arbitrary domains, but discussion is
happening now on which mechanism to use to allow that.
For now, put the camlistore root under $GOPATH/src. Typically $GOPATH
is $HOME, so Camlistore should be at $HOME/src/camlistore.org.
Then you can:
$ go build ./server/camlistored
... etc
The build.pl script is currently disabled. It'll be resurrected at
some point, but with a very different role (helping create a fake
GOPATH and running the go build command, if things are installed at
the wrong place, and/or running fileembed generators).
Many things are certainly broken.
Many things are disabled. (MySQL, all indexing, etc).
Many things need to be moved into
camlistore.org/third_party/{code.google.com,github.com} and updated
from their r60 to Go 1 versions, where applicable.
The GoMySQL stuff should be updated to use database/sql and the ziutek
library implementing database/sql/driver.
Help wanted.
Change-Id: If71217dc5c8f0e70dbe46e9504ca5131c6eeacde
2012-02-19 05:53:06 +00:00
|
|
|
PathLookup(signer, base *blobref.BlobRef, suffix string, at time.Time) (*Path, error)
|
2012-11-03 15:08:37 +00:00
|
|
|
|
|
|
|
// EdgesTo finds references to the provided ref.
|
|
|
|
//
|
|
|
|
// For instance, if ref is a permanode, it might find the parent permanodes
|
|
|
|
// that have ref as a member.
|
|
|
|
// Or, if ref is a static file, it might find static directories which contain
|
|
|
|
// that file.
|
|
|
|
// This is a way to go "up" or "back" in a hierarchy.
|
|
|
|
//
|
|
|
|
// opts may be nil to accept the defaults.
|
|
|
|
EdgesTo(ref *blobref.BlobRef, opts *EdgesToOpts) ([]*Edge, error)
|
2011-03-13 23:10:15 +00:00
|
|
|
}
|
2011-11-28 02:50:50 +00:00
|
|
|
|
2011-11-28 03:29:23 +00:00
|
|
|
// TODO(bradfitz): rename this? This is really about signer-attr-value
|
|
|
|
// (PermanodeOfSignerAttrValue), and not about indexed attributes in general.
|
2011-11-28 02:50:50 +00:00
|
|
|
func IsIndexedAttribute(attr string) bool {
|
|
|
|
switch attr {
|
|
|
|
case "camliRoot", "tag", "title":
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2012-11-03 13:25:48 +00:00
|
|
|
// IsBlobReferenceAttribute returns whether attr is an attribute whose
|
|
|
|
// value is a blob reference (e.g. camliMember) and thus something the
|
|
|
|
// indexers should keep inverted indexes on for parent/child-type
|
|
|
|
// relationships.
|
|
|
|
func IsBlobReferenceAttribute(attr string) bool {
|
|
|
|
switch attr {
|
|
|
|
case "camliMember":
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2011-11-28 02:50:50 +00:00
|
|
|
func IsFulltextAttribute(attr string) bool {
|
|
|
|
switch attr {
|
|
|
|
case "tag", "title":
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|