Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkSet Data feature from SL #64

Merged
merged 29 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d4ab207
Manually applied the Linkset Data patch from zontreck (Aria) that had…
mdickson Nov 5, 2023
f9674b1
Add using around binary compression of linksetdata so that Dispose is…
mdickson Nov 5, 2023
e05b559
Declare and set linksetdata to null when updating prims table where t…
mdickson Nov 5, 2023
d363388
Update the script syntax XML
zontreck Nov 6, 2023
f42a8eb
Apparently forgot to add the Read and Delete protected methods
zontreck Nov 6, 2023
1b4a6f7
Rewrite null checks for older dot net
zontreck Nov 6, 2023
ff5b3c3
Update linkset data accounting on reset
zontreck Nov 6, 2023
89eeb5d
Rename ProtectedData to LinksetDataEntry
zontreck Nov 6, 2023
0b63ff2
Fix protected attribute not being set on new entries
zontreck Nov 7, 2023
893973f
Add the new linkset data functions
zontreck Nov 7, 2023
88d5090
Finish adding remaining linkset data functions
zontreck Nov 7, 2023
884ac48
Fix a compile error due to typo
zontreck Nov 7, 2023
bc498d5
Parity: Don't send value on write protected in event
zontreck Nov 7, 2023
28f8851
Do some code cleanup and fixes in multi-delete function
zontreck Nov 7, 2023
f29ec1b
Parity: When testing passwords, even for unsecured values, treat as s…
zontreck Nov 7, 2023
9613376
Parity: Fix some return values
zontreck Nov 7, 2023
781523f
Oops... compile error
zontreck Nov 7, 2023
646b345
Fix up a few CodqQL scanner errors.
mdickson Nov 9, 2023
017381a
For LinkSetData Find and returning a list of keys a count value of < …
mdickson Nov 13, 2023
778a089
Reformat LinksetDataEntry to be consistent with coding standards. Fun…
mdickson Nov 13, 2023
5543c2f
Change the underlying storage to a SortedList so we return keys in al…
mdickson Nov 14, 2023
eb27523
Fix list handling in llLinksetDataDeleteFound, we can't delete keys f…
mdickson Nov 15, 2023
21f9ce2
Update LSL support for LinksetData to use string.Empty where appropriate
mdickson Nov 15, 2023
1ab558d
Rework the scheme migration to use MEDIUMTEXT for the linksetdata fie…
mdickson Nov 16, 2023
47bd8c8
Revert to using a binary count for the space accounting for the links…
mdickson Nov 16, 2023
2ca03f0
For llLinksetDeleteFound take a copy of the KVP's so we can delete as…
mdickson Nov 16, 2023
07675f8
Add missing stub functions
zontreck Nov 16, 2023
cc8a416
Cleaned unused System.Text.Json references in Data namespaces. Added…
mdickson Nov 16, 2023
1e70f8f
Merge branch 'feature/zontreck-linkset-data' of github.com:OpenSim-NG…
mdickson Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions OpenSim/Data/MySQL/MySQLSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
"AttachedPosY, AttachedPosZ, " +
"PhysicsShapeType, Density, GravityModifier, " +
"Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
"RotationAxisLocks, sopanims, sitactrange, pseudocrc" +
"RotationAxisLocks, sopanims, sitactrange, pseudocrc, " +
"linksetdata" +
") values (" + "?UUID, " +
"?CreationDate, ?Name, ?Text, " +
"?Description, ?SitName, ?TouchName, " +
Expand Down Expand Up @@ -216,7 +217,8 @@ public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
"?AttachedPosY, ?AttachedPosZ, " +
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
"?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
"?RotationAxisLocks, ?sopanims, ?sitactrange, ?pseudocrc)";
"?RotationAxisLocks, ?sopanims, ?sitactrange, ?pseudocrc, " +
"?linksetdata)";

FillPrimCommand(cmd, prim, obj.UUID, regionUUID);

Expand Down Expand Up @@ -1202,6 +1204,11 @@ private SceneObjectPart BuildPrim(IDataReader row)
if(pseudocrc != 0)
prim.PseudoCRC = pseudocrc;

if (!(row["linksetdata"] is DBNull))
{
prim.DeserializeLinksetData((string)row["linksetdata"]);
}

return prim;
}

Expand Down Expand Up @@ -1620,6 +1627,15 @@ private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneG

cmd.Parameters.AddWithValue("sitactrange", prim.SitActiveRange);
cmd.Parameters.AddWithValue("pseudocrc", prim.PseudoCRC);

if (prim.HasLinksetData)
{
cmd.Parameters.AddWithValue("linksetdata", prim.SerializeLinksetData());
}
else
{
cmd.Parameters.AddWithValue("linksetdata", null);
}
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions OpenSim/Data/MySQL/OpenSim.Data.MySQL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Mono.Addins" Version="1.4.1" />
<PackageReference Include="MySqlConnector" Version="2.2.6" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
mdickson marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
8 changes: 8 additions & 0 deletions OpenSim/Data/MySQL/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,11 @@ BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` MEDIUMTEXT default NULL;
COMMIT;

:VERSION 64 #----- material overrides
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` blob default NULL;
COMMIT;

:VERSION 65 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` MEDIUMTEXT default NULL;
COMMIT;
1 change: 1 addition & 0 deletions OpenSim/Data/Null/OpenSim.Data.Null.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
mdickson marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions OpenSim/Data/OpenSim.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@
<PackageReference Include="Mono.Addins" Version="1.4.1" />
<PackageReference Include="MySqlConnector" Version="2.2.6" />
<PackageReference Include="System.Data.SQLite" Version="1.0.116" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
mdickson marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions OpenSim/Data/PGSQL/OpenSim.Data.PGSQL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Mono.Addins" Version="1.4.1" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
mdickson marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
17 changes: 12 additions & 5 deletions OpenSim/Data/PGSQL/PGSQLSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ UPDATE prims SET
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""Vehicle"" = :Vehicle,
""PhysInertia"" = :PhysInertia, ""standtargetx"" =:standtargetx, ""standtargety"" =:standtargety, ""standtargetz"" =:standtargetz,
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc, ""sopanims"" = :sopanims

WHERE ""UUID"" = :UUID ;
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc, ""sopanims"" = :sopanims,
""linksetdata"" =:linksetdata
WHERE ""UUID"" = :UUID ;

INSERT INTO
prims (
Expand All @@ -371,7 +371,7 @@ INSERT INTO
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia"",
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc"", ""sopanims""
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc"", ""sopanims"", ""linksetdata""
) Select
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
Expand All @@ -383,7 +383,7 @@ INSERT INTO
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia,
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc, :sopanims
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc, :sopanims, :LinksetData
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
";

Expand Down Expand Up @@ -1406,6 +1406,11 @@ private static SceneObjectPart BuildPrim(IDataRecord primRow)
prim.Animations = null;
}

if ((primRow["LinksetData"] is DBNull) == false)
{
prim.DeserializeLinksetData(((string)primRow["linksetdata"]));
}

return prim;
}

Expand Down Expand Up @@ -1870,6 +1875,8 @@ private NpgsqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneG
else
parameters.Add(_Database.CreateParameter("sopanims", null));

parameters.Add(_Database.CreateParameter("linksetdata", prim.SerializeLinksetData()));

return parameters.ToArray();
}

Expand Down
5 changes: 5 additions & 0 deletions OpenSim/Data/PGSQL/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -1261,3 +1261,8 @@ BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` bytea NULL;
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` bytea NULL;
COMMIT;

:VERSION 53 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` varchar default NULL;
COMMIT;
1 change: 1 addition & 0 deletions OpenSim/Data/SQLite/OpenSim.Data.SQLite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Mono.Addins" Version="1.4.1" />
<PackageReference Include="System.Data.SQLite" Version="1.0.116" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
mdickson marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions OpenSim/Data/SQLite/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,8 @@ BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
ALTER TABLE `primshapes` ADD COLUMN `MatOvrd` blob default NULL;
COMMIT;

:VERSION 41 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` TEXT default NULL;
COMMIT;
9 changes: 9 additions & 0 deletions OpenSim/Data/SQLite/SQLiteSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,8 @@ private static DataTable createPrimTable()
createCol(prims, "pseudocrc", typeof(int));
createCol(prims, "sopanims", typeof(byte[]));

createCol(prims, "linksetdata", typeof(string));

// Add in contraints
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };

Expand Down Expand Up @@ -1810,6 +1812,11 @@ private SceneObjectPart buildPrim(DataRow row)
prim.Animations = null;
}

if (!(row["linksetdata"] is DBNull))
{
prim.DeserializeLinksetData((string)row["LinksetData"]);
}

return prim;
}

Expand Down Expand Up @@ -2199,6 +2206,8 @@ private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGro

row["pseudocrc"] = prim.PseudoCRC;
row["sopanims"] = prim.SerializeAnimations();

row["linksetdata"] = prim.SerializeLinksetData();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Framework/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class VersionInfo
{
public const string VersionNumber = "0.9.2.2";
public const string AssemblyVersionNumber = "0.9.2.2";
public const string Release = "8688";
public const string Release = "8719";

public static string Version
{
Expand Down
39 changes: 39 additions & 0 deletions OpenSim/Region/Framework/Scenes/LinksetDataEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.IO;

namespace OpenSim.Region.Framework.Scenes
{
public class LinksetDataEntry
{
public LinksetDataEntry(string value, string password)
{
this.Value = value;
this.Password = password;
}

public string Value { get; private set; }
public string Password { get; private set; } = string.Empty;

public bool IsProtected()
{
return (string.IsNullOrEmpty(this.Password) == false);
}

public bool CheckPassword(string pass)
{
// A undocumented caveat for LinksetData appears to be that even for unprotected values, if a pass is provided, it is still treated as protected
if (this.Password == pass)
return true;
else
return false;
}

public string CheckPasswordAndGetValue(string pass)
{
if (string.IsNullOrEmpty(this.Password) || (this.Password == pass))
return this.Value;
else
return string.Empty;
}
}
}
7 changes: 5 additions & 2 deletions OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ public enum ScriptEventCode : int
http_request = 38,

path_update = 40,
linkset_data = 41,

// marks highest numbered event
Size = 41
Size = 42
}

// this is not the right place for this
Expand Down Expand Up @@ -145,7 +146,9 @@ public enum scriptEvents : ulong
anytouch = touch | touch_end | touch_start,
anyTarget = at_target | not_at_target | at_rot_target | not_at_rot_target,
anyobjcollision = collision | collision_end | collision_start,
anylandcollision = land_collision | land_collision_end | land_collision_start
anylandcollision = land_collision | land_collision_end | land_collision_start,

linkset_data = 1UL << 41
}

public struct scriptPosTarget
Expand Down
Loading
Loading