Documentation ¶
Overview ¶
Copyright (C) 2023 Benjamen R. Meyer
https://github.com/BenjamenMeyer/go-tb-dedup
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (C) 2023 Benjamen R. Meyer
https://github.com/BenjamenMeyer/go-tb-dedup
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (C) 2023 Benjamen R. Meyer
https://github.com/BenjamenMeyer/go-tb-dedup
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
const ( SQL_ADD_MESSAGE = "INSERT INTO messages (messageid, location, locationindex, hash, msgFrom, message) VALUES(?, ?, ?, ?, ?, ?)" SQL_GET_MESSAGE_BY_ID = "SELECT messageid, location, locationindex, hash, msgFrom, message FROM messages WHERE messageid = ?" SQL_GET_MESSAGE_BY_LOCATION = "SELECT messageid, location, locationindex, hash, message msgFrom FROM messages WHERE location = ?" SQL_GET_MESSAGE_BY_HASH = "SELECT messageid, location, locationindex, hash, message msgFrom FROM messages WHERE hash = ?" SQL_GET_UNIQUE_MESSAGES = "" /* 130-byte string literal not displayed */ SQL_ADD_RECORD = "INSERT INTO records (messageid, location, locationindex, hash) VALUES(?, ?, ?, ?)" SQL_GET_RECORD_BY_ID = "SELECT messageid, location, locationindex, hash FROM records WHERE messageid = ?" SQL_GET_RECORD_BY_LOCATION = "SELECT messageid, location, locationindex, hash FROM records WHERE location = ?" SQL_GET_RECORD_BY_HASH = "SELECT messageid, location, locationindex, hash FROM records WHERE hash = ?" SQL_GET_UNIQUE_RECORDS = "SELECT messageid, location, locationindex, hash FROM records WHERE hash IN (SELECT DISTINCT hash FROM records)" )
Variables ¶
var SQL_SCHEMA = []schemaEntry{ { // contains filtered or unexported fields }, { // contains filtered or unexported fields }, { // contains filtered or unexported fields }, }
Functions ¶
This section is empty.
Types ¶
type MailData ¶
type MailData interface { SetMessageId(id string) error GetMessageId() (string, error) SetLocation(location string) error GetLocation() (string, error) // NOTE: Location Index is only guaranteed to be accurate while data is not modified // If a toold is modifying data then it should process based on the reverse index values SetLocationIndex(index int) error GetLocationIndex() (int, error) SetHash(hash []byte) error GetHash() ([]byte, error) SetFrom(from string) error GetFrom() (string, error) SetData(data []byte) error GetData() ([]byte, error) }
Data storage
func NewMessageData ¶
func NewMessageData() MailData
type MailRecord ¶
type MailStorage ¶
type MailStorage interface { Open() error Close() error AddMessage(message MailData) error GetMessage(id string) (MailData, error) GetMessagesByLocation(location string) ([]MailData, error) GetMessagesByHash(hash []byte) ([]MailData, error) GetUniqueMessages() (msgs []MailData, err error) AddRecord(message MailRecord) error GetRecord(id string) (MailRecord, error) GetRecordsByLocation(location string) ([]MailRecord, error) GetRecordsByHash(hash []byte) ([]MailRecord, error) GetUniqueRecords() (msgs []MailRecord, err error) }
func NewSqliteStorage ¶
func NewSqliteStorage(diskLocation string) MailStorage
NOTE: provide a location for debug purposes or if in low memory systems in general, it should be sufficient to operate in memory entirely