BDBLocalStorage.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (c) Contributors, http://www.openmetaverse.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *
  27. */
  28. // BDB Support
  29. // Apparently broken on Mono
  30. using BerkeleyDb;
  31. using libsecondlife;
  32. using OpenSim.Framework.Interfaces;
  33. using OpenSim.Framework.Types;
  34. namespace OpenSim.Region.Storage.LocalStorageBDB
  35. {
  36. public class BDBLocalStorage : ILocalStorage
  37. {
  38. const string simDbName = "localsim.db";
  39. DbHash sim;
  40. Db DB;
  41. //BEFormatter formatter;
  42. public BDBLocalStorage()
  43. {
  44. DB = new Db(DbCreateFlags.None);
  45. sim = (DbHash)DB.Open(null, simDbName, null, DbType.Hash, Db.OpenFlags.Create, 0);
  46. //vendorDb = (DbBTree)db.Open(null, VendorDbName, null, DbType.BTree, Db.OpenFlags.Create, 0);
  47. }
  48. public void Initialise(string file)
  49. {
  50. // Blank
  51. }
  52. public void StorePrim(PrimData prim)
  53. {
  54. DbEntry key = new DbEntry();
  55. DbEntry data = new DbEntry();
  56. lock (sim)
  57. {
  58. sim.PutUnique(null, ref key, ref data, DbFile.WriteFlags.AutoCommit);
  59. }
  60. }
  61. public void RemovePrim(LLUUID primID)
  62. {
  63. }
  64. public void LoadPrimitives(ILocalStorageReceiver receiver)
  65. {
  66. }
  67. public float[] LoadWorld()
  68. {
  69. return new float[65536];
  70. }
  71. public void SaveMap(float[] heightmap)
  72. {
  73. }
  74. public void SaveParcels(ParcelData[] parcel_data)
  75. {
  76. }
  77. public void SaveParcel(ParcelData parcel)
  78. {
  79. }
  80. public void RemoveParcel(ParcelData parcel)
  81. {
  82. }
  83. public void RemoveAllParcels()
  84. {
  85. }
  86. public void LoadParcels(ILocalStorageParcelReceiver recv)
  87. {
  88. recv.NoParcelDataFromStorage();
  89. }
  90. public void ShutDown()
  91. {
  92. sim.GetDb().Close();
  93. DB.Close();
  94. }
  95. }
  96. }