Remove LockFactory and make Lock a private class If there are users who really use custom locks, this can be reverted.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/3e229865 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3e229865 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3e229865 Branch: refs/heads/master Commit: 3e2298650d8fc0213ce25078cadeb4f22d45bb5f Parents: 1a8e02d Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Thu Feb 16 17:47:33 2017 +0100 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Mon Feb 20 16:26:21 2017 +0100 ---------------------------------------------------------------------- core/Lucy/Docs/Cookbook/FastUpdates.md | 2 +- core/Lucy/Index/BackgroundMerger.c | 2 +- core/Lucy/Index/FilePurger.c | 2 +- core/Lucy/Index/IndexManager.c | 54 ++++-------- core/Lucy/Index/IndexManager.cfh | 10 +-- core/Lucy/Index/Indexer.c | 2 +- core/Lucy/Store/Lock.cfh | 2 +- core/Lucy/Store/LockFactory.c | 57 ------------- core/Lucy/Store/LockFactory.cfh | 65 --------------- go/lucy/index_test.go | 14 ++-- go/lucy/store_test.go | 13 --- perl/buildlib/Lucy/Build/Binding/Store.pm | 100 ----------------------- perl/lib/Lucy/Store/Lock.pm | 25 ------ perl/lib/Lucy/Store/LockFactory.pm | 25 ------ perl/t/111-index_manager.t | 9 +- test/Lucy/Test/Index/NoMergeManager.c | 2 +- test/Lucy/Test/Index/TestBackgroundMerger.c | 2 +- test/Lucy/Test/Index/TestIndexManager.c | 2 +- 18 files changed, 39 insertions(+), 349 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Docs/Cookbook/FastUpdates.md ---------------------------------------------------------------------- diff --git a/core/Lucy/Docs/Cookbook/FastUpdates.md b/core/Lucy/Docs/Cookbook/FastUpdates.md index 03f152c..2a65b47 100644 --- a/core/Lucy/Docs/Cookbook/FastUpdates.md +++ b/core/Lucy/Docs/Cookbook/FastUpdates.md @@ -197,7 +197,7 @@ void indexing_process(Obj *index, Doc *doc) { void background_merge_process(Obj *index) { - IndexManager *manager = IxManager_new(NULL, NULL); + IndexManager *manager = IxManager_new(NULL); IxManager_Set_Write_Lock_Timeout(manager, 60000); BackgroundMerger bg_merger = BGMerger_new(index, manager); http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Index/BackgroundMerger.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/BackgroundMerger.c b/core/Lucy/Index/BackgroundMerger.c index e9a1ae8..144139d 100644 --- a/core/Lucy/Index/BackgroundMerger.c +++ b/core/Lucy/Index/BackgroundMerger.c @@ -83,7 +83,7 @@ BGMerger_init(BackgroundMerger *self, Obj *index, IndexManager *manager) { ivars->manager = (IndexManager*)INCREF(manager); } else { - ivars->manager = IxManager_new(NULL, NULL); + ivars->manager = IxManager_new(NULL); IxManager_Set_Write_Lock_Timeout(ivars->manager, 10000); } IxManager_Set_Folder(ivars->manager, folder); http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Index/FilePurger.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/FilePurger.c b/core/Lucy/Index/FilePurger.c index 161f030..6811c33 100644 --- a/core/Lucy/Index/FilePurger.c +++ b/core/Lucy/Index/FilePurger.c @@ -58,7 +58,7 @@ FilePurger_init(FilePurger *self, Folder *folder, IndexManager *manager) { ivars->folder = (Folder*)INCREF(folder); ivars->manager = manager ? (IndexManager*)INCREF(manager) - : IxManager_new(NULL, NULL); + : IxManager_new(NULL); IxManager_Set_Folder(ivars->manager, folder); return self; http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Index/IndexManager.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/IndexManager.c b/core/Lucy/Index/IndexManager.c index 15cbbd9..82b9012 100644 --- a/core/Lucy/Index/IndexManager.c +++ b/core/Lucy/Index/IndexManager.c @@ -26,7 +26,6 @@ #include "Lucy/Store/DirHandle.h" #include "Lucy/Store/Folder.h" #include "Lucy/Store/Lock.h" -#include "Lucy/Store/LockFactory.h" #include "Lucy/Util/IndexFileNames.h" #include "Lucy/Util/Json.h" #include "Lucy/Util/StringHelper.h" @@ -84,19 +83,17 @@ static const int32_t S_fibonacci[47] = { }; IndexManager* -IxManager_new(String *host, LockFactory *lock_factory) { +IxManager_new(String *host) { IndexManager *self = (IndexManager*)Class_Make_Obj(INDEXMANAGER); - return IxManager_init(self, host, lock_factory); + return IxManager_init(self, host); } IndexManager* -IxManager_init(IndexManager *self, String *host, - LockFactory *lock_factory) { +IxManager_init(IndexManager *self, String *host) { IndexManagerIVARS *const ivars = IxManager_IVARS(self); ivars->host = host ? Str_Clone(host) : Str_new_from_trusted_utf8("", 0); - ivars->lock_factory = (LockFactory*)INCREF(lock_factory); ivars->folder = NULL; ivars->write_lock_timeout = 1000; ivars->write_lock_interval = 100; @@ -113,7 +110,6 @@ IxManager_Destroy_IMP(IndexManager *self) { IndexManagerIVARS *const ivars = IxManager_IVARS(self); DECREF(ivars->host); DECREF(ivars->folder); - DECREF(ivars->lock_factory); SUPER_DESTROY(self, INDEXMANAGER); } @@ -256,49 +252,34 @@ IxManager_Choose_Sparse_IMP(IndexManager *self, I32Array *doc_counts) { return threshold; } -static LockFactory* -S_obtain_lock_factory(IndexManager *self) { - IndexManagerIVARS *const ivars = IxManager_IVARS(self); - if (!ivars->lock_factory) { - if (!ivars->folder) { - THROW(ERR, "Can't create a LockFactory without a Folder"); - } - ivars->lock_factory = LockFact_new(ivars->folder, ivars->host); - } - return ivars->lock_factory; -} - Lock* IxManager_Make_Write_Lock_IMP(IndexManager *self) { IndexManagerIVARS *const ivars = IxManager_IVARS(self); String *write_lock_name = SSTR_WRAP_C("write"); - LockFactory *lock_factory = S_obtain_lock_factory(self); - return LockFact_Make_Lock(lock_factory, write_lock_name, - (int32_t)ivars->write_lock_timeout, - (int32_t)ivars->write_lock_interval, - true); + return (Lock*)LFLock_new(ivars->folder, write_lock_name, ivars->host, + (int32_t)ivars->write_lock_timeout, + (int32_t)ivars->write_lock_interval, + true); } Lock* IxManager_Make_Deletion_Lock_IMP(IndexManager *self) { IndexManagerIVARS *const ivars = IxManager_IVARS(self); String *lock_name = SSTR_WRAP_C("deletion"); - LockFactory *lock_factory = S_obtain_lock_factory(self); - return LockFact_Make_Lock(lock_factory, lock_name, - (int32_t)ivars->deletion_lock_timeout, - (int32_t)ivars->deletion_lock_interval, - true); + return (Lock*)LFLock_new(ivars->folder, lock_name, ivars->host, + (int32_t)ivars->deletion_lock_timeout, + (int32_t)ivars->deletion_lock_interval, + true); } Lock* IxManager_Make_Merge_Lock_IMP(IndexManager *self) { IndexManagerIVARS *const ivars = IxManager_IVARS(self); String *merge_lock_name = SSTR_WRAP_C("merge"); - LockFactory *lock_factory = S_obtain_lock_factory(self); - return LockFact_Make_Lock(lock_factory, merge_lock_name, - (int32_t)ivars->merge_lock_timeout, - (int32_t)ivars->merge_lock_interval, - true); + return (Lock*)LFLock_new(ivars->folder, merge_lock_name, ivars->host, + (int32_t)ivars->merge_lock_timeout, + (int32_t)ivars->merge_lock_interval, + true); } void @@ -344,7 +325,7 @@ IxManager_Remove_Merge_Data_IMP(IndexManager *self) { Lock* IxManager_Make_Snapshot_Read_Lock_IMP(IndexManager *self, String *filename) { - LockFactory *lock_factory = S_obtain_lock_factory(self); + IndexManagerIVARS *const ivars = IxManager_IVARS(self); if (!Str_Starts_With_Utf8(filename, "snapshot_", 9) || !Str_Ends_With_Utf8(filename, ".json", 5) @@ -356,7 +337,8 @@ IxManager_Make_Snapshot_Read_Lock_IMP(IndexManager *self, size_t lock_name_len = Str_Length(filename) - (sizeof(".json") - 1); String *lock_name = Str_SubString(filename, 0, lock_name_len); - Lock *lock = LockFact_Make_Lock(lock_factory, lock_name, 1000, 100, false); + Lock *lock = (Lock*)LFLock_new(ivars->folder, lock_name, ivars->host, + 1000, 100, false); DECREF(lock_name); return lock; http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Index/IndexManager.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/IndexManager.cfh b/core/Lucy/Index/IndexManager.cfh index be6389a..a94517d 100644 --- a/core/Lucy/Index/IndexManager.cfh +++ b/core/Lucy/Index/IndexManager.cfh @@ -31,7 +31,6 @@ public class Lucy::Index::IndexManager nickname IxManager Folder *folder; String *host; - LockFactory *lock_factory; uint32_t write_lock_timeout; uint32_t write_lock_interval; uint32_t merge_lock_timeout; @@ -42,19 +41,16 @@ public class Lucy::Index::IndexManager nickname IxManager /** Create a new IndexManager. * * @param host An identifier which should be unique per-machine. - * @param lock_factory A LockFactory. */ public inert incremented IndexManager* - new(String *host = NULL, LockFactory *lock_factory = NULL); + new(String *host = NULL); /** Initialize an IndexManager. * * @param host An identifier which should be unique per-machine. - * @param lock_factory A LockFactory. */ public inert IndexManager* - init(IndexManager *self, String *host = NULL, - LockFactory *lock_factory = NULL); + init(IndexManager *self, String *host = NULL); public void Destroy(IndexManager *self); @@ -105,7 +101,7 @@ public class Lucy::Index::IndexManager nickname IxManager /** Create the Lock which controls access to modifying the logical content * of the index. */ - public incremented Lock* + incremented Lock* Make_Write_Lock(IndexManager *self); /** Create the Lock which grants permission to delete obsolete snapshot http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Index/Indexer.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Indexer.c b/core/Lucy/Index/Indexer.c index 2381b26..be5519a 100644 --- a/core/Lucy/Index/Indexer.c +++ b/core/Lucy/Index/Indexer.c @@ -92,7 +92,7 @@ Indexer_init(Indexer *self, Schema *schema, Obj *index, ivars->folder = folder; ivars->manager = manager ? (IndexManager*)INCREF(manager) - : IxManager_new(NULL, NULL); + : IxManager_new(NULL); IxManager_Set_Folder(ivars->manager, folder); // Get a write lock for this folder. http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Store/Lock.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Store/Lock.cfh b/core/Lucy/Store/Lock.cfh index 598c777..bef6dae 100644 --- a/core/Lucy/Store/Lock.cfh +++ b/core/Lucy/Store/Lock.cfh @@ -27,7 +27,7 @@ parcel Lucy; * help clear away stale locks. */ -public abstract class Lucy::Store::Lock inherits Clownfish::Obj { +abstract class Lucy::Store::Lock inherits Clownfish::Obj { Folder *folder; String *name; http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Store/LockFactory.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Store/LockFactory.c b/core/Lucy/Store/LockFactory.c deleted file mode 100644 index bd501f3..0000000 --- a/core/Lucy/Store/LockFactory.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#define C_LUCY_LOCKFACTORY -#include "Lucy/Util/ToolSet.h" - -#include <stdio.h> -#include <ctype.h> - -#include "Lucy/Store/LockFactory.h" -#include "Lucy/Store/Folder.h" -#include "Lucy/Store/Lock.h" - -LockFactory* -LockFact_new(Folder *folder, String *host) { - LockFactory *self = (LockFactory*)Class_Make_Obj(LOCKFACTORY); - return LockFact_init(self, folder, host); -} - -LockFactory* -LockFact_init(LockFactory *self, Folder *folder, String *host) { - LockFactoryIVARS *const ivars = LockFact_IVARS(self); - ivars->folder = (Folder*)INCREF(folder); - ivars->host = Str_Clone(host); - return self; -} - -void -LockFact_Destroy_IMP(LockFactory *self) { - LockFactoryIVARS *const ivars = LockFact_IVARS(self); - DECREF(ivars->folder); - DECREF(ivars->host); - SUPER_DESTROY(self, LOCKFACTORY); -} - -Lock* -LockFact_Make_Lock_IMP(LockFactory *self, String *name, int32_t timeout, - int32_t interval, bool exclusive_only) { - LockFactoryIVARS *const ivars = LockFact_IVARS(self); - return (Lock*)LFLock_new(ivars->folder, name, ivars->host, timeout, - interval, exclusive_only); -} - - http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/core/Lucy/Store/LockFactory.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Store/LockFactory.cfh b/core/Lucy/Store/LockFactory.cfh deleted file mode 100644 index 47152b6..0000000 --- a/core/Lucy/Store/LockFactory.cfh +++ /dev/null @@ -1,65 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -parcel Lucy; - -/** Create Locks. - * - * LockFactory is used to spin off interprocess mutex locks used by various - * index reading and writing components. The default implementation uses - * lockfiles, but LockFactory subclasses which are implemented using - * alternatives such as flock() are possible. - */ - -public class Lucy::Store::LockFactory nickname LockFact - inherits Clownfish::Obj { - - Folder *folder; - String *host; - - /** Create a new LockFactory. - * - * @param folder A [](cfish:Folder). - * @param host An identifier which should be unique per-machine. - */ - public inert incremented LockFactory* - new(Folder *folder, String *host); - - /** Initialize a LockFactory. - * - * @param folder A [](cfish:Folder). - * @param host An identifier which should be unique per-machine. - */ - public inert LockFactory* - init(LockFactory *self, Folder *folder, String *host); - - /** Return a Lock object. - * - * @param name A file-system-friendly id which identifies the - * resource to be locked. - * @param timeout Time in milliseconds to keep retrying before abandoning - * the attempt to obtain a lock. - * @param interval Time in milliseconds between retries. - */ - public incremented Lock* - Make_Lock(LockFactory *self, String *name, int32_t timeout = 0, - int32_t interval = 100, bool exclusive_only); - - public void - Destroy(LockFactory *self); -} - - http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/go/lucy/index_test.go ---------------------------------------------------------------------- diff --git a/go/lucy/index_test.go b/go/lucy/index_test.go index d47785e..bf1ba1e 100644 --- a/go/lucy/index_test.go +++ b/go/lucy/index_test.go @@ -148,7 +148,7 @@ func TestBackgroundMergerMisc(t *testing.T) { func TestIndexManagerAccessors(t *testing.T) { host := "dev.example.com" - manager := NewIndexManager(host, nil) + manager := NewIndexManager(host) if got := manager.GetHost(); got != host { t.Errorf("GetHost: %v", got) } @@ -184,9 +184,9 @@ func TestIndexManagerAccessors(t *testing.T) { } func TestIndexManagerLocks(t *testing.T) { - manager := NewIndexManager("", nil) + manager := NewIndexManager("") manager.SetFolder(NewRAMFolder("")) - if _, ok := manager.MakeWriteLock().(Lock); !ok { + if _, ok := manager.makeWriteLock().(Lock); !ok { t.Errorf("MakeWriteLock") } if _, ok := manager.makeMergeLock().(Lock); !ok { @@ -203,7 +203,7 @@ func TestIndexManagerLocks(t *testing.T) { func TestIndexManagerMergeData(t *testing.T) { var err error - manager := NewIndexManager("", nil) + manager := NewIndexManager("") manager.SetFolder(NewRAMFolder("")) err = manager.WriteMergeData(42) if err != nil { @@ -223,7 +223,7 @@ func TestIndexManagerMergeData(t *testing.T) { } func TestIndexManagerMisc(t *testing.T) { - manager := NewIndexManager("", nil) + manager := NewIndexManager("") manager.SetFolder(NewRAMFolder("")) if got, err := manager.MakeSnapshotFilename(); !strings.Contains(got, "snapshot") || err != nil { t.Errorf("MakeSnapshotFilename: %s, %v", got, err) @@ -238,7 +238,7 @@ func TestIndexManagerMisc(t *testing.T) { func TestIndexManagerRecycle(t *testing.T) { index := createTestIndex("foo", "bar", "baz") - manager := NewIndexManager("", nil) + manager := NewIndexManager("") manager.SetFolder(index) indexer, _ := OpenIndexer(&OpenIndexerArgs{Index: index}) searcher, _ := OpenIndexSearcher(index) @@ -788,7 +788,7 @@ func TestIndexReaderOpen(t *testing.T) { if got, err := OpenIndexReader(folder, snapshot, nil); got == nil || err != nil { t.Errorf("With Snapshot: %v", err) } - manager := NewIndexManager("", nil) + manager := NewIndexManager("") manager.SetFolder(folder) if got, err := OpenIndexReader(folder, nil, manager); got == nil || err != nil { t.Errorf("With IndexManager: %v", err) http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/go/lucy/store_test.go ---------------------------------------------------------------------- diff --git a/go/lucy/store_test.go b/go/lucy/store_test.go index ec51244..89f5057 100644 --- a/go/lucy/store_test.go +++ b/go/lucy/store_test.go @@ -712,19 +712,6 @@ func TestLockFileLockAll(t *testing.T) { lock.Release() } -func TestLockFactoryAll(t *testing.T) { - folder := NewRAMFolder("") - factory := NewLockFactory(folder, "dev.example.com") - lock := factory.MakeLock("write", 10, 42) - if _, ok := lock.(Lock); !ok { - t.Errorf("MakeLock") - } - shlock := factory.MakeSharedLock("read", 10, 42) - if _, ok := shlock.(SharedLock); !ok { - t.Errorf("MakeSharedLock") - } -} - func TestCompoundFiles(t *testing.T) { var err error folder := NewRAMFolder("seg_6b") http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/perl/buildlib/Lucy/Build/Binding/Store.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build/Binding/Store.pm b/perl/buildlib/Lucy/Build/Binding/Store.pm index 4a0dc54..da0ebe4 100644 --- a/perl/buildlib/Lucy/Build/Binding/Store.pm +++ b/perl/buildlib/Lucy/Build/Binding/Store.pm @@ -26,9 +26,7 @@ sub bind_all { $class->bind_filehandle; $class->bind_folder; $class->bind_instream; - $class->bind_lock; $class->bind_lockerr; - $class->bind_lockfactory; $class->bind_outstream; $class->bind_ramfilehandle; $class->bind_ramfolder; @@ -213,68 +211,6 @@ END_XS_CODE Clownfish::CFC::Binding::Perl::Class->register($binding); } -sub bind_lock { - my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; - my $synopsis = <<'END_SYNOPSIS'; - my $lock = $lock_factory->make_lock( - name => 'write', - timeout => 5000, - ); - $lock->obtain or die "can't get lock for " . $lock->get_name; - do_stuff(); - $lock->release; -END_SYNOPSIS - my $constructor = <<'END_CONSTRUCTOR'; -=head2 new - - my $lock = Lucy::Store::Lock->new( - name => 'commit', # required - folder => $folder, # required - host => $hostname, # required - timeout => 5000, # default: 0 - interval => 1000, # default: 100 - ); - -Abstract constructor. - -=over - -=item * - -B<folder> - A Folder. - -=item * - -B<name> - String identifying the resource to be locked, which must -consist solely of characters matching [-_.A-Za-z0-9]. - -=item * - -B<host> - A unique per-machine identifier. - -=item * - -B<timeout> - Time in milliseconds to keep retrying before abandoning -the attempt to obtain a lock. - -=item * - -B<interval> - Time in milliseconds between retries. - -=back -END_CONSTRUCTOR - $pod_spec->set_synopsis($synopsis); - $pod_spec->add_constructor( alias => 'new', pod => $constructor, ); - - my $binding = Clownfish::CFC::Binding::Perl::Class->new( - parcel => "Lucy", - class_name => "Lucy::Store::Lock", - ); - $binding->set_pod_spec($pod_spec); - - Clownfish::CFC::Binding::Perl::Class->register($binding); -} - sub bind_lockerr { my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; my $synopsis = <<'END_SYNOPSIS'; @@ -303,42 +239,6 @@ END_SYNOPSIS Clownfish::CFC::Binding::Perl::Class->register($binding); } -sub bind_lockfactory { - my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; - my $synopsis = <<'END_SYNOPSIS'; - use Sys::Hostname qw( hostname ); - my $hostname = hostname() or die "Can't get unique hostname"; - my $folder = Lucy::Store::FSFolder->new( - path => '/path/to/index', - ); - my $lock_factory = Lucy::Store::LockFactory->new( - folder => $folder, - host => $hostname, - ); - my $write_lock = $lock_factory->make_lock( - name => 'write', - timeout => 5000, - interval => 100, - ); -END_SYNOPSIS - my $constructor = <<'END_CONSTRUCTOR'; - my $lock_factory = Lucy::Store::LockFactory->new( - folder => $folder, # required - host => $hostname, # required - ); -END_CONSTRUCTOR - $pod_spec->set_synopsis($synopsis); - $pod_spec->add_constructor( alias => 'new', sample => $constructor, ); - - my $binding = Clownfish::CFC::Binding::Perl::Class->new( - parcel => "Lucy", - class_name => "Lucy::Store::LockFactory", - ); - $binding->set_pod_spec($pod_spec); - - Clownfish::CFC::Binding::Perl::Class->register($binding); -} - sub bind_outstream { my $xs_code = <<'END_XS_CODE'; MODULE = Lucy PACKAGE = Lucy::Store::OutStream http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/perl/lib/Lucy/Store/Lock.pm ---------------------------------------------------------------------- diff --git a/perl/lib/Lucy/Store/Lock.pm b/perl/lib/Lucy/Store/Lock.pm deleted file mode 100644 index 44e14ef..0000000 --- a/perl/lib/Lucy/Store/Lock.pm +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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 Lucy::Store::Lock; -use Lucy; -our $VERSION = '0.006000'; -$VERSION = eval $VERSION; - -1; - -__END__ - - http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/perl/lib/Lucy/Store/LockFactory.pm ---------------------------------------------------------------------- diff --git a/perl/lib/Lucy/Store/LockFactory.pm b/perl/lib/Lucy/Store/LockFactory.pm deleted file mode 100644 index b8fc429..0000000 --- a/perl/lib/Lucy/Store/LockFactory.pm +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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 Lucy::Store::LockFactory; -use Lucy; -our $VERSION = '0.006000'; -$VERSION = eval $VERSION; - -1; - -__END__ - - http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/perl/t/111-index_manager.t ---------------------------------------------------------------------- diff --git a/perl/t/111-index_manager.t b/perl/t/111-index_manager.t index 16c98ea..3cb616b 100644 --- a/perl/t/111-index_manager.t +++ b/perl/t/111-index_manager.t @@ -37,12 +37,9 @@ use Lucy::Test; my $folder = Lucy::Store::RAMFolder->new; -my $lock_factory = Lucy::Store::LockFactory->new( - folder => $folder, - host => 'me', -); - -my $lock = $lock_factory->make_lock( +my $lock = Lucy::Store::LockFileLock->new( + folder => $folder, + host => 'me', name => 'angie', timeout => 1000, exclusive_only => 0, http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/test/Lucy/Test/Index/NoMergeManager.c ---------------------------------------------------------------------- diff --git a/test/Lucy/Test/Index/NoMergeManager.c b/test/Lucy/Test/Index/NoMergeManager.c index 7c0804b..2a2b71c 100644 --- a/test/Lucy/Test/Index/NoMergeManager.c +++ b/test/Lucy/Test/Index/NoMergeManager.c @@ -25,7 +25,7 @@ NoMergeManager* NoMergeManager_new() { NoMergeManager *self = (NoMergeManager*)Class_Make_Obj(NOMERGEMANAGER); - return (NoMergeManager*)IxManager_init((IndexManager*)self, NULL, NULL); + return (NoMergeManager*)IxManager_init((IndexManager*)self, NULL); } Vector* http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/test/Lucy/Test/Index/TestBackgroundMerger.c ---------------------------------------------------------------------- diff --git a/test/Lucy/Test/Index/TestBackgroundMerger.c b/test/Lucy/Test/Index/TestBackgroundMerger.c index 084c49d..4852d7f 100644 --- a/test/Lucy/Test/Index/TestBackgroundMerger.c +++ b/test/Lucy/Test/Index/TestBackgroundMerger.c @@ -150,7 +150,7 @@ test_bg_merger(TestBatchRunner *runner) { { // Simulate failed background merge. DECREF(bg_merger); - IndexManager *manager = IxManager_new(NULL, NULL); + IndexManager *manager = IxManager_new(NULL); bg_merger = BGMerger_new((Obj*)folder, manager); BGMerger_Prepare_Commit(bg_merger); DECREF(bg_merger); http://git-wip-us.apache.org/repos/asf/lucy/blob/3e229865/test/Lucy/Test/Index/TestIndexManager.c ---------------------------------------------------------------------- diff --git a/test/Lucy/Test/Index/TestIndexManager.c b/test/Lucy/Test/Index/TestIndexManager.c index 7bc0661..4177606 100644 --- a/test/Lucy/Test/Index/TestIndexManager.c +++ b/test/Lucy/Test/Index/TestIndexManager.c @@ -29,7 +29,7 @@ TestIxManager_new() { static void test_Choose_Sparse(TestBatchRunner *runner) { - IndexManager *manager = IxManager_new(NULL, NULL); + IndexManager *manager = IxManager_new(NULL); for (uint32_t num_segs = 2; num_segs < 20; num_segs++) { I32Array *doc_counts = I32Arr_new_blank(num_segs);