From 195987bb1bd09a56a376120ce3e10551d0682dd2 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 13 Mar 2011 16:10:15 -0700 Subject: [PATCH] Add new camli/search package and start of interface. --- build.pl | 3 +++ lib/go/search/Makefile | 9 +++++++++ lib/go/search/search.go | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 lib/go/search/Makefile create mode 100644 lib/go/search/search.go diff --git a/build.pl b/build.pl index 3bdaaa29a..0a988a118 100755 --- a/build.pl +++ b/build.pl @@ -314,6 +314,9 @@ TARGET: lib/go/blobserver - lib/go/blobref - lib/go/testing +TARGET: lib/go/search + - lib/go/blobref + TARGET: lib/go/blobserver/handlers - server/go/auth - server/go/httputil diff --git a/lib/go/search/Makefile b/lib/go/search/Makefile new file mode 100644 index 000000000..fdc81b1a8 --- /dev/null +++ b/lib/go/search/Makefile @@ -0,0 +1,9 @@ +include $(GOROOT)/src/Make.inc + +PREREQ=$(QUOTED_GOROOT)/pkg/$(GOOS)_$(GOARCH)/camli/blobref.a + +TARG=camli/search +GOFILES=\ + search.go\ + +include $(GOROOT)/src/Make.pkg diff --git a/lib/go/search/search.go b/lib/go/search/search.go new file mode 100644 index 000000000..e44349014 --- /dev/null +++ b/lib/go/search/search.go @@ -0,0 +1,35 @@ +/* +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 ( + "camli/blobref" + "os" +) + +type Result struct { + BlobRef *blobref.BlobRef + LastModTime int64 // nanos since epoch +} + +type Index interface { + // dest is closed + // limit is <= 0 for default. smallest possible default is 0 + GetRecentPermanodes(dest chan *Result, + owner []*blobref.BlobRef, + limit int) os.Error +}