public TrinityErrorCode SaveCell(LocalTransactionContext tx, CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff, int offset, int cellSize, ushort cellType) { fixed(byte *p = buff) { return(SaveCell(tx, writeAheadLogOptions, cellId, p + offset, cellSize, cellType)); } }
public TrinityErrorCode UpdateCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff, int offset, int cellSize) { fixed(byte *p = buff) { return(CLocalMemoryStorage.CUpdateCell(cellId, p + offset, cellSize, writeAheadLogOptions)); } }
public TrinityErrorCode SaveCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff, ushort cellType) { fixed(byte *p = buff) { return(CLocalMemoryStorage.CSaveCell(cellId, p, buff.Length, cellType, writeAheadLogOptions)); } }
public TrinityErrorCode UpdateCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff) { fixed(byte *p = buff) { return(CLocalMemoryStorage.CUpdateCell(cellId, p, buff.Length, writeAheadLogOptions)); } }
public TrinityErrorCode AddCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff) { fixed(byte *p = buff) { return(CLocalMemoryStorage.CAddCell(cellId, p, buff.Length, ushort.MaxValue, writeAheadLogOptions)); } }
public TrinityErrorCode UpdateCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff, int offset, int cellSize) { fixed(byte *p = buff) { return(UpdateCell(writeAheadLogOptions, cellId, p + offset, cellSize)); } }
/// <inheritdoc/> public void SaveGenericCell(Trinity.Storage.LocalMemoryStorage storage, CellAccessOptions writeAheadLogOptions, long cellId, ICell cell) { switch ((CellType)cell.CellType) { case CellType.TripleStore: storage.SaveTripleStore(writeAheadLogOptions, cellId, (TripleStore)cell); break; } }
public TrinityErrorCode AddCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff) { fixed(byte *p = buff) { TrinityErrorCode eResult = CLocalMemoryStorage.CLoggedAddCell(cellId, p, buff.Length, StorageConfig.c_UndefinedCellType, writeAheadLogOptions); return(eResult); } }
public TrinityErrorCode SaveCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff, int offset, int cellSize) { fixed(byte *p = buff) { TrinityErrorCode eResult = CLocalMemoryStorage.CLoggedSaveCell(cellId, p + offset, cellSize, StorageConfig.c_UndefinedCellType, writeAheadLogOptions); return(eResult); } }
/// <inheritdoc/> public void SaveGenericCell(Trinity.Storage.LocalMemoryStorage storage, CellAccessOptions writeAheadLogOptions, ICell cell) { switch ((CellType)cell.CellType) { case CellType.Graph: storage.SaveGraph(writeAheadLogOptions, (Graph)cell); break; } }
public TrinityErrorCode AddCell(CellAccessOptions writeAheadLogOptions, long cellId, byte[] buff, int offset, int cellSize, ushort cellType) { fixed(byte *p = buff) { TrinityErrorCode eResult = CLocalMemoryStorage.CLoggedAddCell(cellId, p + offset, cellSize, cellType, writeAheadLogOptions); return(eResult); } }
public void SaveGenericCell(Trinity.Storage.LocalMemoryStorage storage, CellAccessOptions writeAheadLogOptions, long cellId, ICell cell) { switch ((CellType)cell.CellType) { /*FOREACH*/ case CellType.t_cell_name: storage.Savet_cell_name(writeAheadLogOptions, cellId, (t_cell_name)cell); break; /*END*/ } }
public static TrinityErrorCode savecell_4(CellAccessOptions options, IntPtr cell) { try { Global.LocalStorage.SaveGenericCell(options, cell.Target <ICell>()); return(TrinityErrorCode.E_SUCCESS); } catch { return(TrinityErrorCode.E_FAILURE); } }
public static TrinityErrorCode local_savecell_4(CellAccessOptions options, IntPtr cell) { try { ICell c = (ICell)GCHandle.FromIntPtr(cell).Target; Global.LocalStorage.SaveGenericCell(options, c); return(TrinityErrorCode.E_SUCCESS); } catch { return(TrinityErrorCode.E_FAILURE); } }
public void SaveGenericCell(Trinity.Storage.LocalMemoryStorage storage, CellAccessOptions writeAheadLogOptions, long cellId, ICell cell) { switch ((CellType)cell.CellType) { case CellType.Movie: storage.SaveMovie(writeAheadLogOptions, cellId, (Movie)cell); break; case CellType.Celebrity: storage.SaveCelebrity(writeAheadLogOptions, cellId, (Celebrity)cell); break; } }
public static TrinityErrorCode local_usecell_3(long cellId, CellAccessOptions options, ref IntPtr cell, string cellType) { try { ICell c = Global.LocalStorage.UseGenericCell(cellId, options, cellType); GCHandle handle = GCHandle.Alloc(c); cell = GCHandle.ToIntPtr(handle); return(TrinityErrorCode.E_SUCCESS); } catch { cell = IntPtr.Zero; return(TrinityErrorCode.E_FAILURE); } }
/// <inheritdoc/> public unsafe ICellAccessor UseGenericCell(Trinity.Storage.LocalMemoryStorage storage, long cellId, CellAccessOptions options, string cellType) { switch (cellType) { case "TripleStore": return(TripleStore_Accessor._get()._Lock(cellId, options)); default: Throw.invalid_cell_type(); return(null); } }
/// <inheritdoc/> public unsafe ICellAccessor UseGenericCell(Trinity.Storage.LocalMemoryStorage storage, long cellId, CellAccessOptions options) { ushort type; int size; byte * cellPtr; int entryIndex; var err = storage.GetLockedCellInfo(cellId, out size, out type, out cellPtr, out entryIndex); switch (err) { case TrinityErrorCode.E_SUCCESS: break; case TrinityErrorCode.E_CELL_NOT_FOUND: { if ((options & CellAccessOptions.ThrowExceptionOnCellNotFound) != 0) { Throw.cell_not_found(cellId); } else if ((options & CellAccessOptions.CreateNewOnCellNotFound) != 0) { throw new ArgumentException("CellAccessOptions.CreateNewOnCellNotFound is not valid for this method. Cannot determine new cell type.", "options"); } else if ((options & CellAccessOptions.ReturnNullOnCellNotFound) != 0) { return(null); } else { Throw.cell_not_found(cellId); } break; } default: throw new CellNotFoundException("Cannot access the cell."); } try { return(UseGenericCell(cellId, cellPtr, entryIndex, type, options)); } catch (Exception ex) { storage.ReleaseCellLock(cellId, entryIndex); ExceptionDispatchInfo.Capture(ex).Throw(); throw; } }
/// <summary> /// Allocate a generic cell accessor on the specified cell. /// If <c><see cref="Trinity.TrinityConfig.ReadOnly"/> == false</c>, /// on calling this method, it attempts to acquire the lock of the cell, /// and blocks until it gets the lock. /// </summary> /// <param name="storage">A <see cref="Trinity.Storage.LocalMemoryStorage"/> instance.</param> /// <param name="CellId">The id of the specified cell.</param> /// <param name="options">Specifies write-ahead logging behavior. Valid values are CellAccessOptions.StrongLogAhead(default) and CellAccessOptions.WeakLogAhead. Other values are ignored.</param> /// <returns>A <see cref="GraphEngineServer.GenericCellAccessor"/> instance.</returns> public unsafe ICellAccessor UseGenericCell(Trinity.Storage.LocalMemoryStorage storage, long CellId, CellAccessOptions options) { ushort type; int size; byte * cellPtr; int entryIndex; var err = storage.GetLockedCellInfo(CellId, out size, out type, out cellPtr, out entryIndex); switch (err) { case TrinityErrorCode.E_SUCCESS: break; case TrinityErrorCode.E_CELL_NOT_FOUND: { if ((options & CellAccessOptions.ThrowExceptionOnCellNotFound) != 0) { Throw.cell_not_found(CellId); } else if ((options & CellAccessOptions.CreateNewOnCellNotFound) != 0) { throw new ArgumentException("CellAccessOptions.CreateNewOnCellNotFound is not valid for UseGenericCell. Cannot determine new cell type.", "options"); } else if ((options & CellAccessOptions.ReturnNullOnCellNotFound) != 0) { return(null); } else { Throw.cell_not_found(CellId); } break; } default: throw new CellNotFoundException("Cannot access the cell."); } switch ((CellType)type) { case CellType.Movie: return(Movie_Accessor.New(CellId, cellPtr, entryIndex, options)); case CellType.Celebrity: return(Celebrity_Accessor.New(CellId, cellPtr, entryIndex, options)); default: storage.ReleaseCellLock(CellId, entryIndex); throw new CellTypeNotMatchException("Cannot determine cell type."); } ; }
public void SaveGenericCell(LocalMemoryStorage storage, CellAccessOptions writeAheadLogOptions, ICell cell) { int seg = CompositeStorage.GetIntervalIndexByCellTypeID(cell.CellType); CompositeStorage.s_GenericCellOperations[seg].SaveGenericCell(storage, writeAheadLogOptions, cell); }
public unsafe ICellAccessor UseGenericCell(long cellId, byte *cellPtr, int entryIndex, ushort cellType, CellAccessOptions options) { int seg = CompositeStorage.GetIntervalIndexByCellTypeID(cellType); return(CompositeStorage.s_GenericCellOperations[seg].UseGenericCell(cellId, cellPtr, entryIndex, cellType, options)); }
public unsafe static void CWriteAheadLog(long cellId, byte *cellPtr, int cellSize, ushort cellType, CellAccessOptions options) { CLocalMemoryStorage.CWriteAheadLog(cellId, cellPtr, cellSize, cellType, options); }
public unsafe ICellAccessor UseGenericCell(long cellId, byte *cellBuffer, int entryIndex, ushort cellType, CellAccessOptions options) { switch ((CellType)cellType) { case CellType.TripleStore: return(TripleStore_Accessor._get()._Setup(cellId, cellBuffer, entryIndex, options)); default: throw new CellTypeNotMatchException("Cannot determine cell type."); } }
internal static extern TrinityErrorCode CLoggedRemoveCell(long cellId, CellAccessOptions options);
public TrinityErrorCode UpdateCell(CellAccessOptions writeAheadLogOptions, long cellId, byte *buff, int cellSize) { TrinityErrorCode eResult = CLocalMemoryStorage.CLoggedUpdateCell(cellId, buff, cellSize, writeAheadLogOptions); return(eResult); }
internal unsafe static extern void CWriteAheadLog(long cellId, byte *cellPtr, int cellSize, ushort cellType, CellAccessOptions options);
public TrinityErrorCode RemoveCell(CellAccessOptions writeAheadLogOptions, long cellId) { TrinityErrorCode eResult = CLocalMemoryStorage.CLoggedRemoveCell(cellId, writeAheadLogOptions); return(eResult); }
public unsafe ICellAccessor UseGenericCell(LocalMemoryStorage storage, long cellId, CellAccessOptions options) { var err = storage .GetLockedCellInfo(cellId, out int size, out ushort cellType, out byte *cellPtr, out int entryIndex); switch (err) { case Trinity.TrinityErrorCode.E_SUCCESS: break; case Trinity.TrinityErrorCode.E_CELL_NOT_FOUND: { if ((options & CellAccessOptions.ThrowExceptionOnCellNotFound) != 0) { throw new CellNotFoundException("The cell with id = " + cellId + " not found."); } else if ((options & CellAccessOptions.CreateNewOnCellNotFound) != 0) { throw new ArgumentException( "CellAccessOptions.CreateNewOnCellNotFound is not valid for this method. Cannot determine new cell type.", "options"); } else if ((options & CellAccessOptions.ReturnNullOnCellNotFound) != 0) { return(null); } else { throw new CellNotFoundException("The cell with id = " + cellId + " not found."); } } default: throw new CellNotFoundException("Cannot access the cell."); } int seg = CompositeStorage.GetIntervalIndexByCellTypeID(cellType); return(CompositeStorage.s_GenericCellOperations[seg].UseGenericCell(cellId, cellPtr, entryIndex, cellType, options)); }
public TrinityErrorCode SaveCell(LocalTransactionContext tx, CellAccessOptions writeAheadLogOptions, long cellId, byte *buff, int cellSize, ushort cellType) { TrinityErrorCode eResult = CLocalMemoryStorage.TxCLoggedSaveCell(tx.m_pctx, cellId, buff, cellSize, cellType, writeAheadLogOptions); return(eResult); }
public ICellAccessor UseGenericCell(LocalMemoryStorage storage, long cellId, CellAccessOptions options, string cellType) { int seg = CompositeStorage.GetIntervalIndexByCellTypeName(cellType); return(CompositeStorage.s_GenericCellOperations[seg].UseGenericCell(storage, cellId, options, cellType)); }