Пример #1
0
        public unsafe ICell LoadGenericCell(LocalMemoryStorage storage, long cellId)
        {
            var err = storage.GetLockedCellInfo(cellId, out int size, out ushort cellType, out byte *cellPtr, out int entryIndex);

            if (err != Trinity.TrinityErrorCode.E_SUCCESS)
            {
                throw new CellNotFoundException("Cannot access the cell.");
            }
            int seg = CompositeStorage.GetIntervalIndexByCellTypeID(cellType);

            return(CompositeStorage.s_GenericCellOperations[seg].UseGenericCell(cellId, cellPtr, entryIndex, cellType));
        }
Пример #2
0
        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));
        }
Пример #3
0
        public void SaveGenericCell(LocalMemoryStorage storage, CellAccessOptions writeAheadLogOptions, ICell cell)
        {
            int seg = CompositeStorage.GetIntervalIndexByCellTypeID(cell.CellType);

            CompositeStorage.s_GenericCellOperations[seg].SaveGenericCell(storage, writeAheadLogOptions, cell);
        }
Пример #4
0
        public void SaveGenericCell(IKeyValueStore storage, long cellId, ICell cell)
        {
            int seg = CompositeStorage.GetIntervalIndexByCellTypeID(cell.CellType);

            CompositeStorage.s_GenericCellOperations[seg].SaveGenericCell(storage, cellId, cell);
        }
Пример #5
0
        public ICell NewGenericCell(string cellType, string content)
        {
            int seg = CompositeStorage.GetIntervalIndexByCellTypeName(cellType);

            return(CompositeStorage.s_GenericCellOperations[seg].NewGenericCell(cellType, content));
        }
Пример #6
0
        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));
        }
Пример #7
0
        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));
        }
Пример #8
0
        public ushort GetCellType(string cellTypeString)
        {
            int seg = CompositeStorage.GetIntervalIndexByCellTypeName(cellTypeString);

            return(CompositeStorage.s_StorageSchemas[seg].GetCellType(cellTypeString));
        }