本文整理汇总了C#中Couchbase.Lite.Internal.RevisionInternal类的典型用法代码示例。如果您正苦于以下问题:C# RevisionInternal类的具体用法?C# RevisionInternal怎么用?C# RevisionInternal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RevisionInternal类属于Couchbase.Lite.Internal命名空间,在下文中一共展示了RevisionInternal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DocumentChange
internal DocumentChange(RevisionInternal addedRevision, RevisionInternal winningRevision, bool isConflict, Uri sourceUrl)
{
AddedRevision = addedRevision;
WinningRevision = winningRevision;
IsConflict = isConflict;
SourceUrl = sourceUrl;
}
示例2: TestChangeNotification
public void TestChangeNotification()
{
var changeNotifications = 0;
EventHandler<DatabaseChangeEventArgs> handler
= (sender, e) => changeNotifications++;
database.Changed += handler;
// create a document
var documentProperties = new Dictionary<string, object>();
documentProperties["foo"] = 1;
documentProperties["bar"] = false;
documentProperties["baz"] = "touch";
var body = new Body(documentProperties);
var rev1 = new RevisionInternal(body, database);
var status = new Status();
database.PutRevision(rev1, null, false, status);
Assert.AreEqual(1, changeNotifications);
// Analysis disable once DelegateSubtraction
database.Changed -= handler;
}
示例3: TestChangeNotification
public void TestChangeNotification()
{
var countDown = new CountdownEvent(1);
EventHandler<DatabaseChangeEventArgs> handler
= (sender, e) => countDown.Signal();
database.Changed += handler;
// create a document
var documentProperties = new Dictionary<string, object>();
documentProperties["foo"] = 1;
documentProperties["bar"] = false;
documentProperties["baz"] = "touch";
var body = new Body(documentProperties);
var rev1 = new RevisionInternal(body);
database.PutRevision(rev1, null, false);
Sleep(500);
Assert.IsTrue(countDown.Wait(TimeSpan.FromSeconds(1)));
// Analysis disable once DelegateSubtraction
database.Changed -= handler;
}
示例4: Run
public bool Run()
{
string[] bigObj = new string[this._enclosing.GetSizeOfDocument()];
for (int i = 0; i < this._enclosing.GetSizeOfDocument(); i++)
{
bigObj[i] = Test10_DeleteDB._propertyValue;
}
for (int i_1 = 0; i_1 < this._enclosing.GetNumberOfDocuments(); i_1++)
{
//create a document
IDictionary<string, object> props = new Dictionary<string, object>();
props.Put("bigArray", bigObj);
Body body = new Body(props);
RevisionInternal rev1 = new RevisionInternal(body, this._enclosing.database);
Status status = new Status();
try
{
rev1 = this._enclosing.database.PutRevision(rev1, null, false, status);
}
catch (Exception t)
{
Log.E(Test10_DeleteDB.Tag, "Document create failed", t);
return false;
}
}
return true;
}
示例5: ValidationContextImpl
internal ValidationContextImpl(Database database, RevisionInternal currentRevision
, RevisionInternal newRev)
{
this.database = database;
this.currentRevision = currentRevision;
this.newRev = newRev;
}
示例6: TestLoadRevisionBody
// Reproduces issue #167
// https://github.com/couchbase/couchbase-lite-android/issues/167
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
public virtual void TestLoadRevisionBody()
{
Document document = database.CreateDocument();
IDictionary<string, object> properties = new Dictionary<string, object>();
properties.Put("foo", "foo");
properties.Put("bar", false);
document.PutProperties(properties);
NUnit.Framework.Assert.IsNotNull(document.GetCurrentRevision());
bool deleted = false;
RevisionInternal revisionInternal = new RevisionInternal(document.GetId(), document
.GetCurrentRevisionId(), deleted, database);
EnumSet<Database.TDContentOptions> contentOptions = EnumSet.Of(Database.TDContentOptions
.TDIncludeAttachments, Database.TDContentOptions.TDBigAttachmentsFollow);
database.LoadRevisionBody(revisionInternal, contentOptions);
// now lets purge the document, and then try to load the revision body again
NUnit.Framework.Assert.IsTrue(document.Purge());
bool gotExpectedException = false;
try
{
database.LoadRevisionBody(revisionInternal, contentOptions);
}
catch (CouchbaseLiteException e)
{
if (e.GetCBLStatus().GetCode() == Status.NotFound)
{
gotExpectedException = true;
}
}
NUnit.Framework.Assert.IsTrue(gotExpectedException);
}
示例7: DocumentChange
internal DocumentChange(RevisionInternal addedRevision, RevisionInternal winningRevision
, bool isConflict, Uri sourceUrl)
{
this.addedRevision = addedRevision;
this.winningRevision = winningRevision;
this.isConflict = isConflict;
this.sourceUrl = sourceUrl;
}
示例8: PutDoc
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
private RevisionInternal PutDoc(Database db, IDictionary<string, object> props)
{
RevisionInternal rev = new RevisionInternal(props, db);
Status status = new Status();
rev = db.PutRevision(rev, null, false, status);
NUnit.Framework.Assert.IsTrue(status.IsSuccessful());
return rev;
}
示例9: TestForceInsertEmptyHistory
public void TestForceInsertEmptyHistory()
{
var rev = new RevisionInternal("FakeDocId", "1-abcd".AsRevID(), false);
var revProperties = new Dictionary<string, object>();
revProperties.SetDocRevID(rev.DocID, rev.RevID);
revProperties["message"] = "hi";
rev.SetProperties(revProperties);
IList<RevisionID> revHistory = null;
database.ForceInsert(rev, revHistory, null);
}
示例10: TestForceInsertEmptyHistory
public void TestForceInsertEmptyHistory()
{
var rev = new RevisionInternal("FakeDocId", "1-abcd", false);
var revProperties = new Dictionary<string, object>();
revProperties.Put("_id", rev.GetDocId());
revProperties.Put("_rev", rev.GetRevId());
revProperties["message"] = "hi";
rev.SetProperties(revProperties);
IList<string> revHistory = null;
database.ForceInsert(rev, revHistory, null);
}
示例11: TestForceInsertEmptyHistory
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
public virtual void TestForceInsertEmptyHistory()
{
IList<string> revHistory = null;
RevisionInternal rev = new RevisionInternal("FakeDocId", "1-tango", false, database
);
IDictionary<string, object> revProperties = new Dictionary<string, object>();
revProperties.Put("_id", rev.GetDocId());
revProperties.Put("_rev", rev.GetRevId());
revProperties.Put("message", "hi");
rev.SetProperties(revProperties);
database.ForceInsert(rev, revHistory, null);
}
示例12: QueryRow
internal QueryRow(string documentId, long sequence, object key, object value, RevisionInternal revision, IQueryRowStore storage)
{
// Don't initialize _database yet. I might be instantiated on a background thread (if the
// query is async) which has a different CBLDatabase instance than the original caller.
// Instead, the database property will be filled in when I'm added to a CBLQueryEnumerator.
SourceDocumentId = documentId;
SequenceNumber = sequence;
_key = key;
_value = value;
_documentRevision = revision;
_storage = storage;
}
示例13: TestChangeNotification
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
public virtual void TestChangeNotification()
{
// add listener to database
database.Changed += (sender, e) => changeNotifications++;
// create a document
IDictionary<string, object> documentProperties = new Dictionary<string, object>();
documentProperties["foo"] = 1;
documentProperties["bar"] = false;
documentProperties["baz"] = "touch";
Body body = new Body(documentProperties);
RevisionInternal rev1 = new RevisionInternal(body, database);
Status status = new Status();
rev1 = database.PutRevision(rev1, null, false, status);
NUnit.Framework.Assert.AreEqual(1, changeNotifications);
}
示例14: TestChangeNotification
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
public virtual void TestChangeNotification()
{
Database.ChangeListener changeListener = new _ChangeListener_16(this);
// add listener to database
database.AddChangeListener(changeListener);
// create a document
IDictionary<string, object> documentProperties = new Dictionary<string, object>();
documentProperties.Put("foo", 1);
documentProperties.Put("bar", false);
documentProperties.Put("baz", "touch");
Body body = new Body(documentProperties);
RevisionInternal rev1 = new RevisionInternal(body, database);
Status status = new Status();
rev1 = database.PutRevision(rev1, null, false, status);
NUnit.Framework.Assert.AreEqual(1, changeNotifications);
}
示例15: TestLoadDBPerformance
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
public virtual void TestLoadDBPerformance()
{
long startMillis = Runtime.CurrentTimeMillis();
string[] bigObj = new string[GetSizeOfDocument()];
for (int i = 0; i < GetSizeOfDocument(); i++)
{
bigObj[i] = _propertyValue;
}
for (int j = 0; j < GetNumberOfShutAndReloadCycles(); j++)
{
//Force close and reopen of manager and database to ensure cold
//start before doc creation
try
{
TearDown();
manager = new Manager(new LiteTestContext(), Manager.DefaultOptions);
database = manager.GetExistingDatabase(DefaultTestDb);
}
catch (Exception ex)
{
Log.E(Tag, "DB teardown", ex);
Fail();
}
for (int k = 0; k < GetNumberOfDocuments(); k++)
{
//create a document
IDictionary<string, object> props = new Dictionary<string, object>();
props.Put("bigArray", bigObj);
Body body = new Body(props);
RevisionInternal rev1 = new RevisionInternal(body, database);
Status status = new Status();
try
{
rev1 = database.PutRevision(rev1, null, false, status);
}
catch (Exception t)
{
Log.E(Tag, "Document creation failed", t);
Fail();
}
}
}
Log.V("PerformanceStats", Tag + "," + Sharpen.Extensions.ValueOf(Runtime.CurrentTimeMillis
() - startMillis).ToString() + "," + GetNumberOfDocuments() + "," + GetSizeOfDocument
() + ",," + GetNumberOfShutAndReloadCycles());
}