aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--Module.Taskfile.yaml68
-rw-r--r--README.md14
-rw-r--r--Taskfile.yaml75
-rw-r--r--libs/VNLib.Plugins.Sessions.VNCache/src/WebSessionStore.cs52
-rw-r--r--vnlib.plugins.sessions.build.sln65
6 files changed, 249 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore
index 95d3299..bf31850 100644
--- a/.gitignore
+++ b/.gitignore
@@ -352,11 +352,4 @@ MigrationBackup/
# exclude all json files as blanket for config
*.json
-[Ll]iveplugin/
-*.licenseheader
-
-[Tt]askfile.*
-
-/.task/checksum
-
-*.sln \ No newline at end of file
+*.licenseheader \ No newline at end of file
diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml
new file mode 100644
index 0000000..d729ea3
--- /dev/null
+++ b/Module.Taskfile.yaml
@@ -0,0 +1,68 @@
+# https://taskfile.dev
+
+#Called by the vnbuild system to produce builds for my website
+#https://www.vaughnnugent.com/resources/software
+
+#This taskfile performs the build operations for a module, it handles
+#git code updates, msbuild on solutions, and sleet NuGet feed pushes.
+
+#this file must be in the same directory as the solution file
+
+version: '3'
+
+vars:
+ INT_DIR: '{{.SCRATCH_DIR}}/obj/{{.MODULE_NAME}}/'
+ MS_ARGS: '/p:RunAnalyzersDuringBuild=false /p:IntermediateOutputPath="{{.INT_DIR}}" /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true'
+ PACK_OUT: '{{.OUTPUT_DIR}}/{{.HEAD_SHA}}/pkg'
+
+tasks:
+
+#called by build pipeline to sync repo
+ update:
+ cmds:
+ - git remote update
+ - git reset --hard
+ - git pull origin {{.BRANCH_NAME}} --verify-signatures
+
+#called by build pipeline to build module
+ build:
+ cmds:
+ - echo "building module {{.MODULE_NAME}}"
+
+ #re-write semver after hard reset, before build
+ - dotnet-gitversion.exe /updateprojectfiles
+
+ #build debug mode first
+ - task: build_debug
+ - task: build_release
+
+ postbuild_success:
+ cmds:
+ #push packages to the sleet feed (feed path is vnbuild global)
+ - sleet push "{{.PACK_OUT}}/debug/" --source debug --config "{{.SLEET_CONFIG_PATH}}" --force
+ - sleet push "{{.PACK_OUT}}/release/" --source release --config "{{.SLEET_CONFIG_PATH}}" --force
+
+ postbuild_failed:
+ cmds:
+ - echo "postbuild failed {{.MODULE_NAME}}"
+
+#called by build pipeline to clean module
+ clean:
+ cmds:
+ #clean solution
+ - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true
+
+
+#Internal tasks
+ build_debug:
+ internal: true
+ cmds:
+ - dotnet publish -c debug {{.MS_ARGS}}
+ - dotnet pack -c debug {{.MS_ARGS}} -o "{{.PACK_OUT}}/debug/"
+
+ build_release:
+ internal: true
+ cmds:
+ - dotnet publish -c release {{.MS_ARGS}}
+ - dotnet pack -c release {{.MS_ARGS}} -o "{{.PACK_OUT}}/release/"
+ \ No newline at end of file
diff --git a/README.md b/README.md
index a219d5c..c6f2650 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,17 @@
# VNLib.Plugins.Sessions
-This folder contains helper libraries for the developing session providers, plugins for managing distributed object caching, and client runtime implementations.
+This folder contains helper libraries for the developing session providers, plugins for managing distributed object caching, and client runtime implementations.
Each library or plugin library should contain a readme.md file for setup/installation or usage.
-#### Builds
-Debug build w/ symbols & xml docs, release builds, NuGet packages, and individually packaged source code are available on my [website](https://www.vaughnnugent.com/resources/software). All tar-gzip (.tgz) files will have an associated .sha384 appended checksum of the desired download file.
+## Builds
+Debug build w/ symbols & xml docs, release builds, NuGet packages, and individually packaged source code are available on my website (link below). All tar-gzip (.tgz) files will have an associated .sha256 appended checksum of the desired download file.
+
+## Docs and Guides
+Documentation, specifications, and setup guides are available on my website.
+
+[Docs and Articles](https://www.vaughnnugent.com/resources/software/articles?tags=docs,_vnlib.plugins.sessions)
+[Builds and Source](https://www.vaughnnugent.com/resources/software/modules/VNLib.Core)
## License
-Licenses may vary depending on the project. Each project will contain a license file and applicable licensing information in the project's readme. \ No newline at end of file
+Licenses may vary depending on the project. Each project will contain a license file and applicable licensing information in the project's readme. \ No newline at end of file
diff --git a/Taskfile.yaml b/Taskfile.yaml
new file mode 100644
index 0000000..b16b082
--- /dev/null
+++ b/Taskfile.yaml
@@ -0,0 +1,75 @@
+# https://taskfile.dev
+
+#Called by the vnbuild system to produce builds for my website
+#https://www.vaughnnugent.com/resources/software
+
+#This taskfile is called from the root of a project that is being built
+#and the purpose of this taskfile is to package up the output of a build
+#from the solution file, and package it up into a tgz files for distribution
+
+version: '3'
+
+vars:
+ TARGET: '{{.USER_WORKING_DIR}}/bin'
+ RELEASE_DIR: "./bin/release/{{.TARGET_FRAMEWORK}}/publish"
+ SOURCE_OUT: "{{.USER_WORKING_DIR}}/bin/source"
+
+tasks:
+
+ #when build succeeds, archive the output into a tgz
+ postbuild_success:
+ dir: '{{.USER_WORKING_DIR}}'
+ cmds:
+ #pack up source code
+ - task: packsource
+
+ #run post in debug mode
+ - task: postbuild
+ vars: { BUILD_MODE: debug }
+
+ #remove uncessary files from the release dir
+ - powershell -Command "Get-ChildItem -Recurse '{{.RELEASE_DIR}}/' -Include *.pdb,*.xml | Remove-Item"
+
+ #run post in release mode
+ - task: postbuild
+ vars: { BUILD_MODE: release }
+
+
+ postbuild_failed:
+ dir: '{{.USER_WORKING_DIR}}'
+ cmds:
+ - echo "postbuild failed {{.PROJECT_NAME}}"
+
+
+ postbuild:
+ dir: '{{.USER_WORKING_DIR}}'
+ internal: true
+ vars:
+ #the build output directory
+ BUILD_OUT: "{{.USER_WORKING_DIR}}/bin/{{.BUILD_MODE}}/{{.TARGET_FRAMEWORK}}/publish"
+
+ cmds:
+
+ #copy license and readme to target
+ - cd .. && powershell -Command "Copy-Item -Path ./LICENSE.txt -Destination '{{.BUILD_OUT}}/license.txt'"
+ - cd .. && powershell -Command "Copy-Item -Path ./build.readme.md -Destination '{{.BUILD_OUT}}/readme.md'"
+
+ #tar outputs
+ - cd "{{.BUILD_OUT}}" && tar -czf "{{.TARGET}}/{{.BUILD_MODE}}.tgz" .
+
+ packsource:
+ dir: '{{.USER_WORKING_DIR}}'
+ internal: true
+ cmds:
+ #copy source code to target
+ - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' -and \$_.FullName -notlike '*\bin\*' } | Resolve-Path -Relative | tar --files-from - -czf '{{.TARGET}}/src.tgz'"
+
+
+#Remove the output dirs on clean
+ clean:
+ dir: '{{.USER_WORKING_DIR}}'
+ cmds:
+ - cmd: powershell Remove-Item -Recurse './bin'
+ ignore_error: true
+ - cmd: powershell Remove-Item -Recurse './obj'
+ ignore_error: true
diff --git a/libs/VNLib.Plugins.Sessions.VNCache/src/WebSessionStore.cs b/libs/VNLib.Plugins.Sessions.VNCache/src/WebSessionStore.cs
index 12644e1..c0b1e5d 100644
--- a/libs/VNLib.Plugins.Sessions.VNCache/src/WebSessionStore.cs
+++ b/libs/VNLib.Plugins.Sessions.VNCache/src/WebSessionStore.cs
@@ -97,28 +97,8 @@ namespace VNLib.Plugins.Sessions.VNCache
//Run delete/cleanup
Task delete = DeleteSessionAsync(session);
- //Regenid and create new session
- string newId = IdFactory.RegenerateId(entity);
-
- //Get new session empty session for the connection
- WebSession newSession = SessionFactory.GetNewSession(entity, newId, null);
-
- //Reset security information for new session
- newSession.InitNewSession(entity.Server);
-
- IDictionary<string, string> data = newSession.GetSessionData();
-
- //commit session to cache
- Task add = Cache.AddOrUpdateObjectAsync(newId, null, data);
-
- /*
- * Call complete on session for good practice, this SHOULD be
- * called after the update has been awaited though.
- *
- * We also do not need to use the mutal exclusion mechanism because
- * no other connections should have this session's id yet.
- */
- newSession.SessionUpdateComplete();
+ //Create new session for the same connection
+ Task add = CreateNewSession(entity);
//Await the invalidation async
return new(AwaitInvalidate(delete, add));
@@ -129,6 +109,34 @@ namespace VNLib.Plugins.Sessions.VNCache
}
}
+ private Task CreateNewSession(IHttpEvent entity)
+ {
+ //Regenid and create new session
+ string newId = IdFactory.RegenerateId(entity);
+
+ //Get new session empty session for the connection
+ WebSession newSession = SessionFactory.GetNewSession(entity, newId, null);
+
+ //Reset security information for new session
+ newSession.InitNewSession(entity.Server);
+
+ IDictionary<string, string> data = newSession.GetSessionData();
+
+ //commit session to cache
+ Task add = Cache.AddOrUpdateObjectAsync(newId, null, data);
+
+ /*
+ * Call complete on session for good practice, this SHOULD be
+ * called after the update has been awaited though.
+ *
+ * We also do not need to use the mutual exclusion mechanism because
+ * no other connections should have this session's id yet.
+ */
+ newSession.SessionUpdateComplete();
+
+ return add;
+ }
+
private static async Task AwaitInvalidate(Task delete, Task addNew)
{
try
diff --git a/vnlib.plugins.sessions.build.sln b/vnlib.plugins.sessions.build.sln
new file mode 100644
index 0000000..9d3eeb8
--- /dev/null
+++ b/vnlib.plugins.sessions.build.sln
@@ -0,0 +1,65 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{05915194-54D2-41A1-B66C-A4F9D65C5189}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{415CDD00-84E8-4BF2-B70F-C65AD7858D97}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{73CEF8CD-1A5A-4025-A817-DE03805C6FA8}"
+ ProjectSection(SolutionItems) = preProject
+ .gitattributes = .gitattributes
+ .gitignore = .gitignore
+ .onedev-buildspec.yml = .onedev-buildspec.yml
+ GitVersion.yml = GitVersion.yml
+ LICENSE.txt = LICENSE.txt
+ Module.Taskfile.yaml = Module.Taskfile.yaml
+ README.md = README.md
+ Taskfile.yaml = Taskfile.yaml
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionProvider", "plugins\SessionProvider\src\SessionProvider.csproj", "{0ED23A9F-0D59-4754-97E0-87E313D4DEB8}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Plugins.Sessions.Cache.Client", "libs\VNLib.Plugins.Sessions.Cache.Client\src\VNLib.Plugins.Sessions.Cache.Client.csproj", "{5FB9331A-EF5A-4BD5-94AD-2C2952DFF350}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Plugins.Sessions.OAuth", "libs\VNLib.Plugins.Sessions.OAuth\src\VNLib.Plugins.Sessions.OAuth.csproj", "{E8EE87A0-5A0F-4BE0-B30B-DD8CDD1FF616}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Plugins.Sessions.VNCache", "libs\VNLib.Plugins.Sessions.VNCache\src\VNLib.Plugins.Sessions.VNCache.csproj", "{4001BB94-F4C0-417B-981B-F21673387E83}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0ED23A9F-0D59-4754-97E0-87E313D4DEB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0ED23A9F-0D59-4754-97E0-87E313D4DEB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0ED23A9F-0D59-4754-97E0-87E313D4DEB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0ED23A9F-0D59-4754-97E0-87E313D4DEB8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5FB9331A-EF5A-4BD5-94AD-2C2952DFF350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5FB9331A-EF5A-4BD5-94AD-2C2952DFF350}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5FB9331A-EF5A-4BD5-94AD-2C2952DFF350}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5FB9331A-EF5A-4BD5-94AD-2C2952DFF350}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E8EE87A0-5A0F-4BE0-B30B-DD8CDD1FF616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E8EE87A0-5A0F-4BE0-B30B-DD8CDD1FF616}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E8EE87A0-5A0F-4BE0-B30B-DD8CDD1FF616}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E8EE87A0-5A0F-4BE0-B30B-DD8CDD1FF616}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4001BB94-F4C0-417B-981B-F21673387E83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4001BB94-F4C0-417B-981B-F21673387E83}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4001BB94-F4C0-417B-981B-F21673387E83}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4001BB94-F4C0-417B-981B-F21673387E83}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {0ED23A9F-0D59-4754-97E0-87E313D4DEB8} = {415CDD00-84E8-4BF2-B70F-C65AD7858D97}
+ {5FB9331A-EF5A-4BD5-94AD-2C2952DFF350} = {05915194-54D2-41A1-B66C-A4F9D65C5189}
+ {E8EE87A0-5A0F-4BE0-B30B-DD8CDD1FF616} = {05915194-54D2-41A1-B66C-A4F9D65C5189}
+ {4001BB94-F4C0-417B-981B-F21673387E83} = {05915194-54D2-41A1-B66C-A4F9D65C5189}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {8E06E15E-06C0-4681-8563-EAFB6D4F9D16}
+ EndGlobalSection
+EndGlobal