초기커밋
This commit is contained in:
81
ServerCommon/Doc/Backup/BackupDoc.cs
Normal file
81
ServerCommon/Doc/Backup/BackupDoc.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using WORLD_ID = System.UInt32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class DeleteDocAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("doc")]
|
||||
public DynamoDbDocBase? m_deleted_doc_nullable;
|
||||
|
||||
public DeleteDocAttrib()
|
||||
: base(typeof(DeleteDocAttrib).Name)
|
||||
{}
|
||||
|
||||
public void setDeletedDoc(DynamoDbDocBase doc) => m_deleted_doc_nullable = doc;
|
||||
|
||||
public override string toJsonString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "backup#[Deleted DocType PK]"
|
||||
// SK(Sort Key) : "[Deleted DocType SK]"
|
||||
// DocType : BackupDoc
|
||||
// DeleteDocAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class BackupDoc : DynamoDbDocBase, ICopyBackupDocFromDoc
|
||||
{
|
||||
private static string getPrefixOfPK() { return "backup#"; }
|
||||
private static string getPrefixOfSK() { return ""; }
|
||||
|
||||
public BackupDoc(DynamoDbDocBase deletedDoc)
|
||||
: base(typeof(BackupDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(deletedDoc.getPK());
|
||||
setCombinationKeyForSK(deletedDoc.getSK());
|
||||
|
||||
appendAttribWrapper(new AttribWrapper<DeleteDocAttrib>());
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return getPrefixOfPK();
|
||||
}
|
||||
|
||||
public bool copyBackupDocFromDoc(DynamoDbDocBase doc)
|
||||
{
|
||||
var found_attrib = getAttrib<DeleteDocAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(found_attrib, () => $"found_attrib is null !!!");
|
||||
|
||||
found_attrib.setDeletedDoc(doc);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user